Mipmap with mixed texture types

ABSTRACT

In one embodiment, a method for computing a color value for a sampling pixel region includes using a computing system to determine a sampling pixel region within a texture. The texture is associated with mipmap levels having different resolutions of the texture. The mipmap levels include at least a first mipmap level defined by color texels and a second mipmap level defined by distance-field texels. The system may select one of the mipmap levels based on a size of the sampling pixel region and a size of a texel in the selected mipmap level. The system may then compute a color value for the sampling pixel region using the selected mipmap level.

PRIORITY

This application claims the benefit, under 35 U.S.C. § 119(e), of U.S.Provisional Patent Application No. 62/753,676, filed 31 Oct. 2018, whichis incorporated herein by reference.

TECHNICAL FIELD

This disclosure generally relates to text rendering in real-timecomputer graphics for augmented reality and/or virtual realityenvironments.

BACKGROUND

Computer graphics, in general, are visual scenes created usingcomputers. Three-dimensional (3D) computer graphics provide users withviews of 3D objects from particular viewpoints. Each object in a 3Dscene (e.g., a teapot, house, person, etc.) may be defined in a 3Dmodeling space using basic geometries. For example, a cylindrical objectmay be modeled using a cylindrical tube and top and bottom circularlids. The cylindrical tube and the circular lids may each be representedby a network or mesh of smaller polygons (e.g., triangles). Each polygonmay, in turn, be stored based on the coordinates of their respectivevertices in the 3D modeling space.

Even though 3D objects in computer graphics may be modeled in threedimensions, they are conventionally presented to viewers throughrectangular two-dimensional (2D) displays, such as computer ortelevision monitors. Due to limitations of the visual perception systemof humans, humans expect to perceive the world from roughly the samevantage point at any instant. In other words, humans expect that certainportions of a 3D object would be visible and other portions would behidden from view. Thus, for each 3D scene, a computer-graphics systemmay only need to render portions of the scene that are visible to theuser and not the rest. This allows the system to drastically reduce theamount of computation needed.

One problem in computer graphics is efficient and high-quality renderingof 2D graphics (e.g., images consisting of solid color regions, asdistinct from 3D graphics, which typically contains shaded or patternedregions). 2D graphics may be placed in a 3D scene and observed from anyviewpoint, which causes the original 2D graphics to appear distorted.When generating a scene for a display, a rendering system typicallysamples the 2D graphics from the viewpoint of the user/camera todetermine the appropriate color that should be displayed by the pixelsof the screen. The color to be displayed by a pixel is typicallydetermined using a filtering technique, such as bilinear interpolation,that estimates the color based on multiple color information in the 2Dgraphic near a corresponding sampling point. Since multiple colorinformation is used to estimate the color of a single pixel, edges ofthe rendered graphic would appear blurry or less sharp. The goals foraddressing the aforementioned problem for 2D graphics can becharacterized as: (1) defining a more compact way to represent 2Dgraphics images, and (2) defining a way to have crisp edges between thesolid color regions despite the resample filtering that is required inmany graphics applications, such as augmented and virtual reality, toaccommodate geometric distortions, which normally causes blurring.

These problems are particularly acute when rendering text, whichrequires rendering fine edge details between the text and backgroundregions. When the text is static, it is not a problem to take time andcomputational resources to pre-render it with high precision. Forexample, a character may be stored as a texture with color data (e.g.,red, green, and blue) per texel and, when needed, rendered onto ascreen. The character may look reasonably good when it is small, butpixilation and aliasing may become more pronounced if it is magnified,rotated, or distorted (e.g., due to changes in transformation,perspective, or the text itself changes). To improve a font's appearanceand sharpness when rendered, a specialized technique must be used, suchas a technique that stores the character shapes (e.g., glyphs) instructures called signed distance fields.

SUMMARY OF PARTICULAR EMBODIMENTS

Embodiments described herein address the problems related to graphicsrendering, as discussed above. Particular embodiments relate to usingdistance field labels (“labels,” as used herein, refers to characters,fonts, glyphs, icons, and other 2D images consisting of solid colorregions) to support more complex label patterns, such as those requiringmore than two color patterns rather than just the binary color scheme(e.g., background and foreground) supported by traditional distancefield techniques. Since text is an example of a particularly difficultand common problem that could be solved by the present disclosure, textwill be used as the primary example to illustrate the various techniquesdescribed. However, it should be noted that the techniques describedherein could apply to different types of labels, including icons andother 2D images.

In particular embodiments, when sampling points on a particular surface,the distance field of a particular sampled point may be computed usingbilinear interpolation of the distance fields of the four nearesttexels. The sampled distance field may indicate whether the samplingpoint falls “in” or “out” of the label (e.g., in the body of the text orout in the background). Then, the next step may be to select the colorindex encoded within the four texels. Two of the four texels may encodethe color for “in” and the other two texels encode the color for “out.”In particular embodiments, if the sampled distance field is determinedto be “out,” then the index of one of the two “out” texels that isclosest to the sampled point would be used. Similarly, if the sampleddistance field is determined “in,” then the index of the closer “in”texel would be used.

Particular embodiments described here relate to using dual distancefield labels based on a set of distances for four interleaved indices.Dual distance fields are used to support complex shapes that have sharpconvex inner and outer corners. In particular embodiments, using singledistance fields based on the distance to only one edge may result incorners not being reconstructed correctly, and instead look rounded orchipped in the resulting image. A solution to this is to use dualdistance fields that are based on distances to two different types ofedges. An ambiguity introduced by dual distance fields is that, at edgeintersections, there could be four different regions associated withfour different combinations of being inside or outside of each of theedges. Particular embodiments enable dual distance field labels toencode the color that should be used in each inside/outside scenario(e.g., if a sampling point falls in a region that is inside both edges,it should be painted red; if a sampling point falls in a region that isinside of one edge and outside of the other edge, it should be paintedpurple, etc.). Each dual distance field label, as the name suggests, hastwo distance fields: distance0 (e.g., the distance to type0 edge) anddistance1 (e.g., the distance to type1 edge). The two distance fields ofeach label may encode two respective color indices. A pair of dualdistance field labels, therefore, may be used to encode four indices,one for each “in” and “out” combination. Then, once the fourcombinations of “in” and “out” are determined in relation to each of thetwo different edge types, an index can be accessed that is specified foreach “in/out” combination in order to determine the color look-up tableentry to use to label the color of a sample point.

Particular embodiments described here relate to using distance fieldoptimization techniques. As a first example, to minimize undesirablepixilation and/or aliasing effects, a mipmap may be used to accommodatedifferent pixel sampling sizes. Mipmap is a technique of scaling anoriginal high-resolution texture map and pre-filtering the texture mapinto multiple resolutions, which may be selectively used duringrendering based on the relative sizes between texture texels andsampling pixels. With distance fields, when the distance between twoedges is below two texels, there would only be at most a single texelbetween the edges. As such, there is an inherent ambiguity as to whichedge the distance value of that texel measures. To address this issue,particular embodiments may configure a mipmap chain of a label to haveboth distance field textures and RGBA textures. Distance field texturesmay be used when larger resolution textures are needed, and RGBAtextures may be used when smaller textures are needed. The inferiorquality of a RGBA texture would not be prominent since its screencoverage would be small. As a second example of distance-fieldoptimization, comparison of the most significant bit can be done toeliminate interpolations in situations where it is not needed. As athird example of distance field optimization, transparent results may bedetected so that the corresponding pixel can be discarded.

Embodiments of the invention may include or be implemented inconjunction with an artificial reality system. Artificial reality is aform of reality that has been adjusted in some manner beforepresentation to a user, which may include, e.g., a virtual reality (VR),an augmented reality (AR), a mixed reality (MR), a hybrid reality, orsome combination and/or derivatives thereof. Artificial reality contentmay include completely generated content or generated content combinedwith captured content (e.g., real-world photographs). The artificialreality content may include video, audio, haptic feedback, or somecombination thereof, and any of which may be presented in a singlechannel or in multiple channels (such as stereo video that produces athree-dimensional effect to the viewer). Additionally, in someembodiments, artificial reality may be associated with applications,products, accessories, services, or some combination thereof, that are,e.g., used to create content in an artificial reality and/or used in(e.g., perform activities in) an artificial reality. The artificialreality system that provides the artificial reality content may beimplemented on various platforms, including a head-mounted display (HMD)connected to a host computer system, a standalone HMD, a mobile deviceor computing system, or any other hardware platform capable of providingartificial reality content to one or more viewers.

The embodiments disclosed herein are only examples, and the scope ofthis disclosure is not limited to them. Particular embodiments mayinclude all, some, or none of the components, elements, features,functions, operations, or steps of the embodiments disclosed herein.Embodiments according to the invention are in particular disclosed inthe attached claims directed to a method, a storage medium, a system anda computer program product, wherein any feature mentioned in one claimcategory, e.g. method, can be claimed in another claim category, e.g.system, as well. The dependencies or references back in the attachedclaims are chosen for formal reasons only. However, any subject matterresulting from a deliberate reference back to any previous claims (inparticular multiple dependencies) can be claimed as well, so that anycombination of claims and the features thereof are disclosed and can beclaimed regardless of the dependencies chosen in the attached claims.The subject-matter which can be claimed comprises not only thecombinations of features as set out in the attached claims but also anyother combination of features in the claims, wherein each featurementioned in the claims can be combined with any other feature orcombination of other features in the claims. Furthermore, any of theembodiments and features described or depicted herein can be claimed ina separate claim and/or in any combination with any embodiment orfeature described or depicted herein or with any of the features of theattached claims.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 an example distance field label with various sample positionsplaced inside and outside the edges of a character shape.

FIGS. 2A and 2B illustrate example diagrams of even and odd texellocations, respectively, on an array of texels for fine grain colorindex selection.

FIG. 3A illustrates using a fine grain color index selection method onan array of texels associated with single distance fields. FIG. 3Billustrates an example color look-up table for use with the fine graincolor index selection.

FIG. 4 illustrates an example method for using the fine grain colorindex to determine the color of a sample position using single distancefields.

FIGS. 5A and 5B illustrate example diagrams of even-row and odd-rowtexel locations, respectively, on an array of texels for coarse graincolor index selection.

FIG. 6A illustrates using a coarse grain color index selection method onan array of texels. FIG. 6B illustrates an example color look-up tablefor use with the coarse grain color index selection.

FIG. 7 illustrates an example method for using the coarse grain colorindex to determine the color of a sample position using single distancefields.

FIG. 8 illustrates an example region where two different edge-type edgesmeet at a vertex and result in four different regions associated withfour different combinations of being inside or outside of each of theedges.

FIG. 9A illustrates using a fine grain color index selection method onan array of texels associated dual distance fields. FIG. 9B illustratesexample distance field labels associated with aligned two-by-two sets oftexels used for the fine grain color index selection.

FIG. 10 illustrates an example method for using the fine grain colorindex to determine the color of a sample position using dual distancefields.

FIG. 11A illustrates using a coarse grain color index selection methodon an array of texels associated dual distance fields. FIG. 11Billustrates example distance field labels associated with alignedtwo-by-two sets of texels used for the coarse grain color indexselection.

FIG. 12 illustrates an example method for using the coarse grain colorindex to determine the color of a sample position using dual distancefields.

FIG. 13 illustrates an example mipmap with mixed distance-field texturesand RGBA textures.

FIG. 14 illustrates an example method for computing a color value for apixel using a mipmap with mixed mipmap levels.

FIG. 15 illustrates an example method for determining the color for asampling location without interpolation.

FIG. 16 illustrates an example computer system.

DESCRIPTION OF EXAMPLE EMBODIMENTS

This application describes techniques for text rendering in computergraphics when the transformation, perspective, or the text itself maychange dynamically in real-time, such as in situations of text rendering(or the rendering of other types of labels, such as icons, glyphs, 2Dimages, etc.) in augmented reality (AR) and virtual reality (VR). Oneexample technique used in real-time graphics rendering relies on storingthe character shapes (e.g., glyphs) in structures called signed distancefields, or simply distance fields. In general, a distance field is theresult of a signed distance transformation applied to a subset ofN-dimensional space, which is a vector shape that is to be rendered(e.g., text, icons, etc.). The distance field maps each point P of thespace to a scalar signed distance value. A signed distance may bedefined as follows: If the point P belongs to the subset (e.g., if thepoint P is within the text or icon to be rendered), the signed distanceis the positive minimum distance to the closest edge of the shape of thesubset. This is also referred to as being “inside” or “in,” and may beencoded by having the most significant bit (MSB) of an m-bit distancefield be 1. If it does not belong to the subset (e.g., if the point P isoutside the text or icon to be rendered), the signed distance is thenegative distance to the closest edge of the shape of the subset. Thisis also referred to as being “outside” or “out,” and may be encoded byhaving the MSB of an m-bit distance field be 0. The distance field mayuse Euclidean distances whose domain is two-dimensional space only.

Generally, particular embodiments of display engines for driving ARand/or VR displays are fed data to display and perform distortion,resampling, composition, and color correction necessary to adjust forthe characteristics of the AR/VR display device (e.g., a device used byor worn by a user). Each frame of a scene displayed to the user isgenerated based on the current head position, current eye position,current eye movement, other relevant positions of the user, or anycombination thereof. The details of the scene of each frame may begenerated by performing bilinear interpolations on surfaces that aregenerated based on the rendering results of a standard computerprocessing unit (CPU) or graphics processing unit (GPU). A surface maybe a rectangular texture map with a transformation matrix to specify itslocation in the scene. The fundamental unit of the texture map is atexel (also known as texture element or texture pixel), and the texturemap includes arrays of texels representing a particular texture space.In particular, there are two types of surfaces: images surfaces andlabel surfaces. Image surfaces may have textures that store RGB(red-green-blue color spaces) or RGBA (red-green-blue-alpha colorspaces) components per texel and are used to render shaded images (e.g.,video frames or scenes rendered by a GPU). Label surfaces may havetextures that store signed distances and color indices and are used torender objects that consist of solid color regions, which includes textsuch as letters, numbers, characters, etc., in addition to icons. UnlikeRGBA labels, distance field labels are not susceptible to blurry edgescaused by interpolation operations. Particular embodiments describedherein will focus on techniques associated with label surfaces.

Currently, distance field labels are restricted to two colors, such asblack text or foreground with white background and/or cutouts, or viceversa. As such, to support more complex label color patterns, theembodiments discussed herein describe how an improved distance fieldlabel can support more than two colors. In particular embodiments, an8-bit texel may be encoded with (1) a distance field stored on 6 bits ofthe texel and (2) a color index (e.g., a value indicating a desiredcolor or, conceptually, a pointer to an entry in a color look-up table)stored on the remaining 2 bits of the texel. For example, the 8-bittexel may be used to define a white text with a transparent background(e.g., with color index 0) that allows other objects positioned behindthe text to be seen. The number of bits allocated to the index dictateshow many colors could be supported by the label. For example, an indexof 2 bits allows for the selection of up to four unique colors (e.g.,transparent, orange, yellow, and purple). The embodiments describedherein also contemplate concatenating the indices of two texels to forman index with more bits. For example, by concatenating the 2-bit indicesof two texels, a 4-bit index may be formed, which allows for theselection of up to sixteen unique colors (e.g., one transparent colorand fifteen colors). The color indices are used to look up an RGBA colordepending on the high order bit of the interpolated distance, asdiscussed in more detail below.

Using Single Distance Fields to Determine Color of a Sample Position

Particular embodiments described herein are directed to texels that eachhave a single distance field. At a high level, distance fields are usedto indicate the location of edges between solid-color regions (e.g.,foreground and background) on label surfaces. Each texel stores arepresentation of the distance of the texel center to the nearest edge,bounded by a maximum distance, beyond which a texel is determined to beoutside a particular array. In particular embodiments, 6-bits may beallocated for indicating the distance value, with the MSB representingwhether the texel center is “in” (e.g., represented by 1) or “out”(e.g., represented by 0). If the texel is far away from an edge, theremaining 5-bits would be a large value; conversely, if the texel isclose to an edge, the remaining 5-bits would be small. In particularembodiments, for a sample position P, bilinear interpolation of thedistance fields of the four closest texels can be used to determinewhich side of the edge the sample position P is on. As an example, azero (0) in the high order bit (e.g., the MSB) of the interpolateddistance indicates that the sample position P is outside the regiondefined by the edge and a one (1) in the high order bit of theinterpolated distance indicates that the sample position P is inside theregion defined by the edge. Notably, the distance fields in particularembodiments described herein may be unsigned numbers, so that the lowestvalue is zero and no value encodes a position exactly on the edge. Thisis in contrast to other distance fields encoded using signed values(e.g., the MSB of a distance field may represent whether the value ispositive or negative, which corresponds to “in” or “out,” or zero, whichcorresponds to “on edge”). The unsigned distance field encoding isbeneficial because it avoids certain issues, such as when an edge passesthrough the center of a texel.

As discussed above, each texel of a label texture may include both adistance and a color index value. The color index values are used toselect an entry in a color look-up table that can be customized for eachlabel. For a given sample position, which texel's color index to selectdepends on the interpolated distance of the sample position (e.g.,whether its MSB=0 (out) or MSB=1 (in)) and the location of the sampleposition in texture space relative to the nearby texels. In particularembodiments, each label surface specifies a base address into the colortable and a control bit that selects whether the surface uses a singleset of color table entries for each combination of in and out edges, orwhether each combination uses a different set of color table entries.

Each color index selects a color for all samples within a given regionin the texture, rather than just for the texel that it is stored with.For single distance labels, two interleaved color indices specify thecolor to use when the MSB of the interpolated distance is zero (out) orone (in). For dual distance labels, four interleaved color indicesspecify the color to use for the four combinations of the MSB of the twointerpolated distances.

Certain situations merit additional consideration. As an example, todetermine which edge a texel is on when the edge passes directly throughthe center of the texel (e.g., when the distance is zero), a “top left”rule may be used in which a pixel that falls on an edge is included ifthe inside of the object is to the right of the pixel, or, for ahorizontal edge, if the inside of the object is below the pixel. Asanother example, all texels outside the array are treated as havingdistances of zero and indices of zero. As a result, any sample positionthat is more than 0.5 texel outside the grid of distance texels resultsin MSB=0 (out) for all edges and produces an index of zero. The firstcolor table entry for each surface is typically set to transparent(i.e., no color). As such, nothing is rendered for sample positions morethan 0.5 texel outside the array.

FIG. 1 illustrates an example texel array 100 with various samplepositions placed inside and outside the edges of a character shape 110.The character shape 110 illustrates an “A” in which an edge 120separates a color of the character shape 110 (e.g., the shaded region)from a color of the background 130. Texels (not shown for simplicity)within the shaded region are encoded with distance values indicatingthat they are “in” (with MSB=1) whereas texels outside of the shadedregion are encoded with distance values indicating that they are “out”(with MSB=0). In addition, boundary 140 delineates the background 130from the region beyond the array texel 100. Various sample points areshown, including sample point 150 located inside the region defined bythe edge 120 of the character shape 110, sample point 160 locatedoutside the region defined by the edge 120 of the character shape 110,sample point 170 located on the edge 120 of the character shape 110, andsample 180 located outside of the boundary 140 of the texel array 100.

As will be discussed in more detail below, linear interpolation of theunsigned distance functions of the four nearest texels for each ofsample points 150, 160 would determine that sample point 150'sinterpolated distance has an MSB=1 (in) and sample point 160'sinterpolated distance has an MSB=0 (out). In addition, linearinterpolation of the distance functions of the four nearest texels forsample point 170 would determine that the interpolated distance isexactly half the range of the unsigned distance field, which indicatesthat the sample point 170 is directly on the edge 120 (if the distancefield is signed rather than unsigned, the “on edge” scenario would berepresented by an interpolated distance of 0). The color for samplepoint 170 would thus be determined based on the “top left” rule.Moreover, sample point 180 would be determined to be outside of thetexel array 100 and thus have a unsigned distance of zero and an indexof zero associated with a no color, or “transparent” result.

In particular embodiment, there may be two ways that colors indices arespecified. The first method allows finer grain color selection from fourcolors, the first of which is transparent. For example, as mentionedabove, a texel may be represented by 8-bits, with 6-bits encoding thedistance field and 2-bits encoding the color index. The 2-bit colorindex can be mapped to four colors. Although this example allocatesparticular number of bits to encode the distance field and color index,a person of ordinary skill in the art would recognize that any otherallocation of bits may be used instead (e.g., 7, 8, 9, or 20 bits toencode the distance field and 1, 4, 6, or 10 bits to encode the colorindex). For instance, a second method described herein may have coarsergrain color selection and allows for sixteen color options, the first ofwhich is transparent. The two methods are described as having “finegrain” and “coarse grain” in the sense that the size of the textureregion dictated by a set of color indices in the “fine grain” method issmaller than that of the “coarse grain” method. Each of these methodswill be discussed in detail below.

Single Distance Field Fine Grain Color Selection

The discussion of the fine grain color selection method for singledistance field labels will focus on the embodiment shown in FIGS. 2A,2B, 3A, 3B, and the method described in FIG. 4. Briefly, FIGS. 2A and 2Billustrate example diagrams of even and odd texel locations,respectively, on an array 200 of texels for fine grain color indexselection. FIG. 3A illustrates using a fine grain color index selectionmethod on the array 300 of texels associated with single distancefields. FIG. 3B illustrates an example color look-up table for use withthe fine grain color index selection. In addition, FIG. 4 illustrates anexample method 400 for using the fine grain color index to determine thecolor of a sample position using texels with single distance fields.

FIGS. 2A and 2B illustrate an example six-by-six array 200 of texels inwhich the texels located at even or odd positions, respectively, aredepicted at the center of the diamond-shaped regions. The texels in thearray 200 are arranged in a texture map at positions on a U-axis 210 anda V-axis 212 coordinate system. The circles represent the center oftexel positions on array 200. In embodiments where texel sampling isperformed by hardware, the coordinate may be specified using binaryvalues. For example, Rows 0-3 along the V-axis 212 are respectivelyreferred to as Rows 00, 01, 10, and 11, and Columns 0-3 along the U-axis210 are respectively referred to as Columns 00, 01, 10, and 11 (forsimplicity, the additional Rows and Columns are not referenced, as doingso will add to the number of bits to refer to them). Texel 214, forexample, is located at u=00 and v=00 (or (00, 00)); texel 216 is located(00, 01), texel 218 is located at (01, 00), texel 220 is located at (01,01) and so on. For simplicity, only the first four rows and the firstfour columns of the six-by-six array 200 are referenced here.

For fine grain color index selection, the texels in the array 200 aresorted into even or odd positions (i.e., “even” texels or “odd” texels)in order to determine which texel to use to look up the color associatedwith a region. In particular embodiments, texels in array 200 aredetermined to be either even or odd based on whether the lowest orderbit (e.g., least significant bit LSB) of the U and V coordinatesassociated with the texel are the same digit. As an example, texel 214is located at the U-V coordinates of u=00 and v=00, and since theU-coordinate and V-coordinate have the same last digit (i.e., “0”),texel 216 is considered to be an even texel. In addition, texel 220 isalso an even texel because the U-V coordinates of u=01 and v=01 have thesame last digit (i.e., “1”). Even texels, such as 214 and 220, areillustrated in FIG. 2A as being located within the diamond-shapedregions, e.g., 222 and 224, respectively. As will be described infurther detail below, a sample point that falls in such a diamond-shapedregion (e.g., 222) would be assigned the color specified by the colorindex of the texel (e.g., 214) at the center of the region, providedthat the sample point is associated with the “even” texels (e.g., basedon the MSB of the interpolated distance of the sample point, describedin further detail below). On the other hand, texel 216 is located at theU-V coordinates of u=01 and v=00, and since the U-coordinate andV-coordinate do not have the same last digit, texel 216 is an odd texel.In addition, texel 218 is also an odd texel because the U-V coordinatesof u=00 and v=01 do not have the same last digit. Odd texels, such as216 and 218 illustrated in FIG. 2B, are located within thediamond-shaped regions, e.g., 226 and 228, respectively. As will bedescribed in further detail below, a sample point that falls in such adiamond-shaped region (e.g., 226) would be assigned the color specifiedby the color index of the texel at the center of the region, providedthat the sample point is associated with the “odd” texels (e.g., basedon the MSB of the interpolated distance of the sample point, describedin further detail below). As shown in FIGS. 2A and 2B, every two-by-tworegion of the array 200 includes two even texels (e.g., texels 214 and220) and two odd texels (e.g., texels 216 and 218).

In particular embodiments, texels 214, 216, 218, and 220 are eachassociated with a distance field that includes a 6-bit distance and a2-bit color index (the particular assigned bit length could vary). Asdiscussed above, the distance field of each of texels 214, 216, 218, and220 stores a representation of the distance from the center of the texelto the nearest edge, and the color index of each of texels 214, 216,218, and 220 stores a reference to an entry in a color look-up table fordetermining the color associated with the texel. For the fine graincolor selection method, the purpose of determining whether a texel iseven or odd is for selecting which texels to use based on adetermination of whether a sample point is outside or inside a regiondefined by an edge. As discussed in more detail below, if the highestorder bit of the interpolated distance of sample point is 0 (i.e.,MSB=0), then the sample point is determined to be outside the regiondefined by the edge and the pair of even texels (e.g., texels 214 and220) are selected to determine the color of the sample. On the otherhand, if the highest order bit of the interpolated distance of thesample point is 1 (i.e., MSB=1), then the sample point is determined tobe inside the region defined by the edge and the pair of odd texels(e.g., texels 218 and 218) are selected to determine the color of thesample. In addition, a shaded area 230 represents locations outside thetexels of array 200 (e.g., texels that are more than 0.5 texel outsidethe array) and thus have distances of zero and indices of zeroassociated with a no color, or “transparent” result.

FIG. 3A illustrates an example four-by-four array 300 of texels. Similarto the embodiment describe above in relation to FIGS. 2A and 2B, thetexels in the array 300 are arranged on a texture map at positions on aU-axis 310 and V-axis 312 coordinate system. In embodiments where texelsampling is performed by hardware, the coordinates may be specifiedusing binary-values (e.g., Rows 0-3 are respectively referred to as Rows00, 01, 10, and 11, and Columns 0-3 are respectively referred to asColumns 00, 01, 10, 11). The circles represent texel position on array300. Texel 318, for example, is located at u=00 and v=00 (or (00, 00));texel 322 is located at (00, 01), and so on. A sample point P 314 isselected (e.g., based on visibility tests, such as by using ray castingto cast a ray from a pixel location onto a label surface in 3D viewspace and mapping that point of intersection into the texel array 300).The color to be selected for the sample point 314 is determined usingthe fine grain color selection method 400. As shown in FIG. 4, themethod 400 may start at step 410, where the four nearest texels to thesample point 314 are determined so that the distance of those texels maybe used to determine the interpolated distance of the sample point 314.FIG. 3A illustrates that the four nearest texels to sample point 314 arethe texels in the two-by-two-texel region 316, and includes texels 318,320, 322, and 324.

In particular embodiments, texels 318, 320, 322, and 324 are eachassociated with a distance field that includes a 6-bit distance and a2-bit color index. As discussed above, the distance field of each oftexels 318, 320, 322, and 324 stores a representation of the distancefrom the center of the texel to the nearest edge. In addition, the colorindex of each of texels 318, 320, 322, and 324 stores a reference to anentry in a color look-up table for determining the color associated withthe texel. FIG. 3B illustrates an example color look-up table with fourdifferent entries. In particular examples shown, entry “0” correspondsto “transparent” (i.e., no color), entry “1” (or 01 in binary)corresponds to the color red, entry “2” (or 10 in binary) corresponds tothe color green, and entry “3” (or 11 in binary) corresponds to thecolor blue. Thus, as an example, texel 318 may have a color index withentry “3” indicating that the texel is blue, texel 320 may have a colorindex with entry “3” indicating that the texel is blue, texel 322 mayhave a color index with entry “1” indicating that the texel is red, andtexel 324 may have a color index with entry “2” indicating that thetexel is green.

As shown in FIG. 4, at step 420, the distance value D for sample point314 is interpolated based on the distance fields of each of texels 318,320, 322, and 324. Then, at step 430, the highest order bit of theinterpolated distance value D for sample point 314 is determined to beeither 0 or 1. In order words, if the MSB of the interpolated distancevalue D for sample point 314 is determined to be 0, then sample point314 is determined to be outside the region defined by the edge. On theother hand, if the MSB of the interpolated distance value D for samplepoint 314 is determined to be 1, then sample point 314 is determined tobe inside the region defined by the edge.

At step 440, if it is determined that the MSB of the interpolateddistance value D for sample point 314 is 0, sample point 314 isdetermined to be outside the region defined by the edge, and two eventexels are selected from the two-by-two-texel region 316. In particularembodiments, similar to the discussion of the embodiment of FIGS. 2A and2B, texels in array 300 are determined to be either even or odd based onwhether the lowest order bit (e.g., least significant bit) of the U andV coordinates associated with the texel are the same digit. As anexample, texel 318 is located at the U-V coordinates of u=00 and v=00,and since the U-coordinate and V-coordinate have the same last digit(i.e., “0”), texel 318 is considered to be an even texel. In addition,texel 324 is also an even texel because the U-V coordinates of u=01 andv=01 have the same last digit (i.e., “1”). On the other hand, texel 320is located at the U-V coordinates of u=01 and v=00, and since theU-coordinate and V-coordinate do not have the same last digit, texel 320is an odd texel. In addition, texel 322 is also an odd texel because theU-V coordinates of u=00 and v=01 do not have the same last digit. Inother words, based on these determinations, an even texel pair 326include texels 318, 324, and an odd texel pair 328 includes texels 320,322.

As such, at step 440, if it is determined that the MSB of theinterpolated distance value D for sample point 314 is 0, then the eventexel pair 326 is selected. Once the texel pair is selected, the method400 moves onto step 450 to determine which even texel of the even texelpair 326 is closer in distance to sample point 314. Particularembodiments of how this may be determined in hardware is as follows. Inarray 300 where distance is measured in texel units, the distancebetween two adjacent and orthogonal texel locations is one distance unit(e.g., the distance between texels 318 and 322 is 1, and the distancebetween texels 318 and 320 is also 1). Since the four texels in region316 define a unit square, any point along a diagonal 332 of the unitsquare would have a U-axis distance and a V-axis distance that sum up to1 unit distance. For example, a point that coincides with where texel320 is would have a U-axis distance of 1 from the left edge of the unitsquare and a V-axis distance of 0 from the top edge of the unit square,resulting in a sum of 1 unit distance when its U-axis distance andV-axis distance are added together. As another example, a point in thecenter of the unit square would have 0.5 as both the U-axis and V-axisdistances, resulting in a sum of 1 unit distance. As such, one way forhardware to determine which of the two even texels is closer to thesample point 314 is by determining, conceptually, which side of thediagonal 332 the sample point 314 falls in. For the even texel pair 326,any point on or to the left of diagonal 332 would have its U-axis andV-axis distances sum up to 1 distance unit or less (in this example, apoint falling on the diagonal is being counted as being on closer to theleft texel). If so, then the index of texel 326 would be deemed to becloser to the sample point 314 and, therefore, selected. Conversely, anypoint to the right of diagonal 332 would have its U-axis and V-axisdistances sum up to greater than 1 distance unit. If so, then the indexof texel 324 would be deemed to be closer to the sample point 314 and,therefore, selected.

Particular embodiments for selecting a fine index is more formallydefined as follows. Let the location of a sample point (e.g., samplepoint 314) be represented by [U₁, V₁]. First, compute U₁′=U₁ mod 2 andV₁′=V₁ mod 2, or in other words, truncate U₁ and V₁ to one integer bit(e.g., a distance) and their fractional bits. Conceptually, thetruncation performs a normalization operation that transforms the U-Vcoordinate of the sample point 314 into a smaller regional coordinate.For example, conceptually, the texel array 300 may be divided intogrids, with horizontal gridlines stemming from every even V position(i.e., V positions whose least significant bit is 0) and verticalgridlines stemming from every even U position (i.e., U positions whoselease significant bit is 0). Each grid, therefore, is a square with2-unit-distance sides. Within each grid, the upper-left corner's U-Vcoordinate would both have zeros as their least significant two bits,and each grid may have its own regional coordinate system. The truncatedresults U₁′ and V₁′ represent the sample point's transformed coordinatesin a regional coordinate system of a 2-unit-distance grid. U₁′ and V₁′may also represent the U-axis distance and V-axis distance relative tothe 2-unit-distance grid.

Each 2-unit-distance grid contains four unit squares, each defined by aset of adjacent and orthogonal texels (e.g., the region 316 includes onesuch unit square). Conceptually, the next step is to determine, withinthe unit square containing the sample point, which of the two eventexels (if the interpolated distance's MSB=0) or which of the two oddtexels (if the interpolated distance's MSB=1) is closest to the samplepoint. In particular embodiments, if the interpolated distance's MSB=0,then the closest even texel may be determined as follows. First, ifU₁′<1, then let distance D_(u)=U₁′; otherwise let distance D_(u)=2−U₁′.If V₁′<1, then let distance D_(v)=V₁′; otherwise let D_(v)=2−V₁′. Acombined UV distance D₁ may then be computed by:Distance D₁(for MSB=0)=D_(u)+D_(v).If this distance D₁ is equal to or less than 1, then the index of theeven texel at the even U position (i.e., the U position whose leastsignificant bit is 0) is selected, otherwise the index of the even texelat the odd U position is selected (i.e., the U position whose leastsignificant bit is 1). The least significant bit of the V position andthe least significant bit of the U position of the selected even texelwould be the same. Using FIG. 3A as an example, if the MSB of theinterpolated distance of a sample point is 0 and if the sample point ison the right side of diagonal 332 separating the even texels 318 and324, D_(u) would be U₁′ and D_(v) would be V₁′. Since the sample pointis on the right side of the diagonal, we know that D_(u)+D_(v) would begreater than 1. As such, the index of the even texel at the odd Uposition would be selected, in which case texel 324 would be selectedsince its U coordinate is [01]. As can be seen from the figure, eventexel 324 would be closer than even texel 318 to a sample point on theright side of diagonal 232.

On the other hand, if at step 430 it is determined that the MSB of theinterpolated distance value D for sample point 314 is 1, sample point314 would be deemed to be inside the region defined by the edge, and atstep 350, two odd texels would be selected from the two-by-two-texelregion 316. Thus, at step 350, if it is determined that the MSB of theinterpolated distance value D for sample point 314 is 1, then odd texelpair 328 is selected. Once the texel pair is selected, the method 400moves onto step 470 to determine which odd texel of the odd texel pair328 is closer in distance to sample point 314. In particularembodiments, if the interpolated distance's MSB=1, then the closest oddtexel may be determined as follows. First, if U₁′<1, then let distanceD_(u)=U₁′; otherwise let distance D_(u)=2−U₁′. If V₁′<1, then letdistance D_(v)=1−V₁′; otherwise let D_(v)=V₁′−1. A combined UV distanceD₂ may then be computed by:Distance D₂(for MSB=1)=D_(u)+D_(v).If this distance D₂ is equal to or less than 1, then the index of theodd texel at the even U position (i.e., the U position whose leastsignificant bit is 0) is selected, otherwise the index of the odd texelat the odd U position is selected (i.e., the U position whose leastsignificant bit is 1). The least significant bit of the V position andthe least significant bit of the U position of the selected event texelwould be the opposite in this case. Using FIG. 3A as an example, if theMSB of the interpolated distance of a sample point is 1 and if thesample point is on the right side of diagonal 330 separating the oddtexels 322 and 320, D_(u) would be U₁′ and D_(v) would be 1−V₁′. Basedon this definition, we know that D_(u)+D_(v) would be greater than 1. Assuch, the index of the odd texel at the odd U position would beselected, in which case texel 320 would be selected since its Ucoordinate is [01]. As can be seen from the figure, odd texel 320 wouldbe closer than odd texel 322 to a sample point on the right side ofdiagonal 330.

Then, at step 480, the color index of the selected even or odd texelthat is determined to be the closest in distance to sample point 314 isused to determine the color for sample point 314. As an example, if atstep 450 it is determined that the even texel 318 is closest in distanceto sample point 314 (which has MSB=0), then sample point 314 isdetermined to be coded blue (e.g., as determined based on the assumptiondiscussed above that the index of texel 318 points to blue). Instead, ifat step 450 it is determined that even texel 324 is closest in distanceto sample point 314, then sample point 314 is determined to be codedgreen. On the other hand, if at step 470 it is determined that odd texel320 is closest in distance to sample point 314 (which now has MSB=1),then sample point 314 is determined to be coded blue. Instead, if atstep 470 it is determined that odd texel 322 is closest in distance tosample point 314, then sample point 314 is determined to be coded red.Particular embodiments may repeat one or more steps of the method ofFIG. 4, where appropriate. Although this disclosure describes andillustrates particular steps of the method of FIG. 4 as occurring in aparticular order, this disclosure contemplates any suitable steps of themethod of FIG. 4 occurring in any suitable order. Moreover, althoughthis disclosure describes and illustrates an example method for usingthe fine grain color index to determine the color of a sample positionusing single distance fields including the particular steps of themethod of FIG. 4, this disclosure contemplates any suitable method forusing the fine grain color index to determine the color of a sampleposition using single distance fields including any suitable steps,which may include all, some, or none of the steps of the method of FIG.4, where appropriate. Furthermore, although this disclosure describesand illustrates particular components, devices, or systems carrying outparticular steps of the method of FIG. 4, this disclosure contemplatesany suitable combination of any suitable components, devices, or systemscarrying out any suitable steps of the method of FIG. 4.

As can be seen from the embodiments described above for encoding colorindices in a texel array and deducing the appropriate color index to usebased on interpolation results, a distance field label can be configuredto support more than two colors. Thus, the letter “A” shown in theexample above could define, for example, the foreground “A” to be black,a background in the internal cutout of the “A” to be red, and the restof the background to be purple. Near the border region of the foregroundof “A” and the internal cutout of “A,” texels within that region maydefine the desired color scheme for “in” (e.g., black) and “out” (e.g.,red). Similarly, texels near the border of the foreground of “A” and therest of the background may have a different definition of the desiredcolor scheme for “in” (e.g., black) and “out” (e.g., purple). Thistechnique has the advantage of using distance fields (e.g., sharpnessregardless of size and/or orientation) yet mitigating the traditionaldrawback of having limited color options. If the number of bitsallocated to specifying the index increase (e.g., 3 bits instead of 2),then the number of color options would increase also increase (e.g., 3bits allows for to 8 color options).

Single Distance Field Coarse Grain Color Selection

The discussion of the coarse grain color selection method using singledistance fields will focus on the embodiment shown in FIGS. 5A, 5B, 6A,and 6B and the method described in FIG. 7. Briefly, FIGS. 5A and 5Billustrate example diagrams of even-row and odd-row texel locations,respectively, on an array of texels for coarse grain color indexselection. FIG. 6A illustrates using a coarse grain color indexselection method on an array of texels. FIG. 6B illustrates an examplecolor look-up table for use with the coarse grain color index selection.In addition, FIG. 7 illustrates an example method 700 for using thecoarse grain color index to determine the color of a sample positionusing single distance fields.

FIGS. 5A and 5B illustrate an example six-by-six array 500 of texels forcoarse grain color selection in which the pairs of texels located ateven-row or odd-row positions, respectively, are depicted withinsquare-shaped regions. The coarse grain color selection method differs,in at least one aspect, from the fine grain color selection method inthat the coarse grain color selection method uses a pair of texels,rather than a single texel, to specify the desired color index for aregion surrounding the texel pair (e.g., by concatenating the indices ofthe pair of texels). As a result, the coverage area of each texel pairis larger than the coverage area of each texel used in the fine grainmethod. Any sample point that falls in a region covered by a texel pairwould have the color specified by the combined color indices of thattexel pair, provided that the texel pair is the ones assigned to theparticular “in” or “out” status of the sample point (as determined basedon its MSB, in particular embodiments). The benefit of using a pair oftexels to encode the color index is that the number of bits availablefor encoding the index increases (e.g., from 2 bits to 4 bits), whichmeans that more color options are available (e.g., from 4 to 16 colors).Since the first color table entry is typically set to transparent (i.e.,no color), this leaves up to 15 unique colors that can be encoded by the4-bit index used in the coarse grain color selection method.

As illustrated, the texels in the array 500 are arranged in a texturemap at positions on a U-axis 510 and a V-axis 512 coordinate system. Thecircles represent texel positions on array 500. In embodiments wheretexel sampling is performed by hardware, the coordinates of a texel maybe specified using binary values. For example, Rows 0-3 along the V-axis512 are respectively referred to as Rows 00, 01, 10, and 11, and Columns0-3 along the U-axis 510 are respectively referred to as Columns 00, 01,10, and 11 (additional Rows and Columns could be similarly numberedusing additional bits). Texel 514, for example, is located at u=00 andv=00 (or (00, 00)); texel 516 is located (00, 01), texel 518 is locatedat (01, 00), texel 520 is located at (01, 01) and so on. For simplicity,only the first four rows and the first four columns of the six-by-sixarray 500 are referenced here.

For the coarse grain color index selection, the texels in the array 500are sorted into even-row or odd-row positions (i.e., “even-row” texelsor “odd-row” texels) in order to determine which texel to use to look upthe color associated with a sample position. In particular embodiments,the even and odd rows in the array 500 are determined based on the leastsignificant bit of the V position of the associated row. As an example,texels 514, 516, 518, and 520 all have a V-position v=00 in which theleast significant bit is 0. Thus, texels 514, 516, 518, and 520 are alleven-row texels. On the other hand, texels 522, 524, 526, 528 all have aV-position v=01 in which the least significant bit is 1. Thus, texels522, 524, 526, 528 are all odd-row texels.

As shown in FIGS. 5A and 5B, every aligned two-by-two texels includestwo even-row texels (e.g., texels 514 and 516) and two odd-row texels(e.g., texels 522 and 524). In particular embodiments, the pairs ofeven-row texels (e.g., an even-texel pair 514 and 516, anothereven-texel pair 518 and 520) may be used to encode the color indices forthe “out” case. To illustrate the coverage region for each pair ofaligned even-row texels, FIG. 5A shows pairs of even-row texels locatedwithin their respective square-shaped regions (e.g., even-texel pair 514and 516 are located within region 530, even-texel pair 518 and 520 arelocated within region 532, etc.). In addition, the pairs of odd-rowtexels (e.g., an odd-row texel pair 522 and 524, and anther odd-rowtexel pair 526 and 528) may be used to encode the color index for the“in” case and are illustrated in FIG. 5B as being located within thesquare-shaped regions 534 and 536, respectively. In addition, similar toFIGS. 3A and 3B discussed above, a shaded area 538 represents locationsoutside the texels of array 500 (e.g., texels that are more than 0.5texel outside the array) and thus have distances of zero and indices ofzero associated with a no color, or “transparent” result.

FIG. 6A illustrates an example four-by-four array 600 of texels. Thesixteen texels in the array 600 are arranged on a texture map atpositions specified in a coordinate system with a U-axis 610 and aV-axis 612. In particular hardware embodiments, the U position and Vposition may be specified in binary, as described with reference to FIG.2A. The circles represent texel positions on array 600. A sample point614 is selected (similar to how sample point 314 is selected above), andthe color to be selected for sample point 614 is determined using thecoarse grain color selection method 700 of FIG. 7. In particularembodiments, as discussed above, the pairs of texels in each even row(e.g., determined based on the least significant bit of the V positionof the even texel being 0) may be used to encode the color index for the“out” case, and the pairs of texels in each odd row (e.g., determinedbased on the least significant bit of the V position of the odd texelbeing 1) may be used to encode the color index for the “in” case. Tosummarize, as used herein, “even-row texel” refers to a texel on an evenrow of the texel array (e.g., the least significant bit of the Vposition of an even-row texture is 0), and “odd-row texel” refers to atexel on an odd row of the texel array (e.g., the least significant bitof the V position of an odd-row texture is 1). The two indices of eachtexel pair are concatenated, and the result is associated with bothtexels during filtering (i.e., both texels of the texel pair would beassociated with the same concatenated index).

As shown in FIG. 7, the method 700 may start at step 710, where theindices of adjacent, aligned pairs of even or odd texels areconcatenated and stored with both associated texels in the texel bufferin the pixel block. This may be part of the data loading process whentexel data is loaded into memory. As an example, as shown in FIG. 6A,for even-row texels located at V position v=00, the two indices of thepair of even-row texels 634 (including adjacent even-row texels 618 and620) are concatenated and the result is associated with both texels. Inaddition, the pair of even-row texels 636 (including adjacent even-rowtexels 622 and 624) are concatenated and the result is associated withboth texels. Likewise, for odd-row texels located at V position v=01,the two indices of the pair of odd-row texels 638 (including adjacentodd-row texels 626 and 628) are concatenated and the result isassociated with both texels, and the two indices of the pair of odd-rowtexels 640 (including adjacent odd-row texels 630 and 632) areconcatenated and the result is associated with both texels. Inembodiments where each texel's color index is 2-bits, concatenating thecolor indices of two texels would result in a 4-bit color index. Forexample, if the color index of texel 618 is the 2-bit binary number 11and the color index of texel 620 is the 2-bit binary number 00,concatenating the two may result in the 4-bit index 0011 (if thelower-ordered bits are filled by the index of the texel in the evenU-position) or 1100 (if the lower-order bits are filled by the index ofthe texel in the odd U-position). Thereafter, the 4-bit index, such as0011, would be associated with (e.g., stored with) both texels 618 and620.

Then, at step 720, the four nearest texels to sample point 614 aredetermined and loaded into memory so that the distance values of thosetexels may be used to determine the interpolated distance of the samplepoint 614. FIG. 6A illustrates that the four nearest texels to thesample point 614 are even-row texels 620, 622 and odd-row texels 628,630. In particular embodiments, even-row texels 620, 622 and odd-rowtexels 628, 630 are each associated with a distance field that includesa 6-bit distance and the 4-bit color index generated in step 710. Asdiscussed above, the 4-bit color index stores a reference to an entry ina 16-color look-up table for determining the color associated with thetexel. FIG. 6B illustrates an example color look-up table with 16different entries. In particular examples shown, entry “0” correspondsto “transparent” (i.e., no color), entry “1” (or 0001 in binary)corresponds to the color red, entry “2” (or 0010 in binary) correspondsto the color green, and entry “3” (or 0011 in binary) corresponds to thecolor blue, and so on until entry “16” (or 1111 in binary). Thus, as anexample, the even-row pair 634 including even-row texels 618 and 620 mayeach have a concatenated color index of “3” or “0011,” indicating thatthe color associated with both texels is blue; the even-row pair 636including even-row texels 622 and 624 may also have a concatenated colorindex of “3” or “0011,” indicating that the color associated with bothtexels is also blue; the odd-row pair 638 including odd-row texels 626and 628 may have a concatenated color index “1” or “0001,” indicatingthat the color associated with both texels is red; and the odd-row pair640 including odd-row texels 630 and 632 may have a concatenated colorindex of “2” or “0010,” indicating that the color associated with bothtexels is green.

At step 730, the distance value D for sample point 614 is interpolatedbased on the distance values of the four nearest texels 620, 622, 628,630. Then, at step 740, the highest order bit of the interpolateddistance value D for sample point 614 is determined to be either 0 or 1.In order words, if the MSB of the interpolated distance value D forsample point 614 is determined to be 0, then sample point 614 isdetermined to be outside the region defined by the edge. On the otherhand, if the MSB of the interpolated distance value D for sample point614 is determined to be 1, then sample point 614 is determined to beinside the region defined by the edge. Thus, at step 740, if it isdetermined that the MSB of the interpolated distance value D for samplepoint 614 is 0, sample point 614 is determined to be outside the regiondefined by the edge, and at step 750, two even-row texels are selectedfrom the closest 4 texels (as previously described, even-row texels areused to encode color indices in the “out” case and odd-row texels areused to encode color indices in the “in” case, in accordance withparticular coarse grain index embodiments). As such, in this example,the two even-row texels selected would be even-row texels 620 and 622.

Once the even-row texels 620 and 622 are selected, the method 700 movesonto step 760 to determine which of the two even-row texels 620 and 622is closer in distance to sample point 614. Particular embodiments of howthis may be determined in hardware is as follows. As discussed above, inarray 600 where distance is measured in texel units, the distancebetween two adjacent texel locations is one distance unit (e.g., thedistance between even-row texels 620 and 622 is 1, and the distancebetween odd-row texels 628 and 630 is also 1). Since these four nearesttexels 620, 622, 628, 6230 define a unit square, any point along avertical line 642 between the even-row texels 620 and 622 and betweenthe odd-row texels 628 and 630 corresponds to a position that is 0.5texel from each of even-row texels 620 and 622 and odd-row texels 628and 630 along the U-axis direction. As such, one way for hardware todetermine which of the two even texels is closer to sample point 614 isby determining, conceptually, which side of the vertical line 642 thesample point 614 falls on (e.g., by determining whether the sample point614 is less than or equal to 0.5 texels, or alternatively, greater than0.5 texels, from the closest integer U-axis position, as discussed indetail below). As an example, for the even-row texels 620 and 622, anypoint on or to the left of vertical line 642 would have a distance froma closest integer U-axis position (e.g., u=01) that is less than orequal to 0.5 texels. If so, then the index of even-row texel 620 (i.e.,the “left” even-row texel) would be deemed to be closer to the samplepoint 614, and therefore, selected. Conversely, any point to the rightof vertical line 642 would have a distance from the closest integerU-axis position (e.g., u=01) than is greater than 0.5 texels. If so,then the index of even-row texel 422 (i.e., the “right” even-row texel)would be deemed to be closer to sample point 614, and therefore,selected.

Particular embodiments for selecting a coarse index is more formallydefined as follows. Let the location of a sample point (e.g., samplepoint 614) be represented by (U₂, V₂). First, compute U₂′=U₂ mod 1, orin other words, truncate U₂ to a fractional bit (i.e., the remainder).Conceptually, the truncation performs a normalization operation thatcalculates how much farther, in the U-axis direction, a sample point isfrom the closest integer U position. As an example, for a sample pointthat is interpolated to be at a decimal location corresponding to 1.3texels along the U-axis, the truncation of the distance value wouldresult in a remainder of 0.3. Similarly, for a sample point that isinterpolated to be at a binary location corresponding to 2.7 texelsalong the U-axis, the truncation of the distance value would result in aremainder of 0.7.

From the closest 4 texels to the sample point 614, as discussed above,either the pair of even-row texels 620, 622 or the pair of odd-rowtexels 628, 630 are of interest based on the MSB of the interpolateddistance value D for sample point 614. Conceptually, the next step is todetermine which of the two even-row texels (if the interpolateddistance's MSB=0) or which of the two odd-row texels (if theinterpolated distance's MSB=1) is closest to the sample point. Inparticular embodiments, if the MSB of the interpolated distance is 0(thereby indicating that the pair of even-row texels are of interest),then the closest one of the even-row texels may be determined asfollows. As previous discussed, first compute U₂′=U₂ mod 1, where U₂ isthe U-position of the sample point in texture space. Then, if U₂′>0.5,the index of the even texel at the even U position (i.e., the U positionwhose least significant bit is 0) is selected. Otherwise, if U₂′≤0.5,the index of the even texel at the odd U position is selected (i.e., theU position whose least significant bit is 1). Using FIG. 6A as anexample, if the MSB of the interpolated distance of a sample point is 0and if U₂′=U₂ mod 1≤0.5, then the sample point would fall on the leftside of vertical line 642. As such, the index of the even-row texel atthe odd U-position would be selected, in which case even-row texel 620would be selected since its U coordinate is [01]. As can be seen fromthe figure, even-row texel 620 would be closer than even-row texel 622to the sample point 614.

On the other hand, if at step 740 it is determined that the MSB of theinterpolated distance value D for sample point 614 is 1, sample point614 is determined to be inside the region defined by the edge, and atstep 770, the two odd-row texels are selected from the closest 4 texels.As such, the two odd-row texels selected would be odd-row texels 628 and630. Once the odd-row texels 628 and 630 are selected, the method 700moves onto step 780 to determine which of the odd-row texels 628 and 630is closer in distance to sample point 614. The closest odd-row texel maybe determined similar to how the closest even-row texel is determined,as discussed above. Specifically, if the texture location of a samplepoint (e.g., sample point 614) is (U₂, V₂), first compute U₂′=U₂ mod 1,or in other words, truncate U₂ to a fractional bit (i.e., theremainder). Then, if U₂′>0.5, the index of the odd-row texel at the evenU position (i.e., the U position whose least significant bit is 0) isselected. Otherwise, if U₂′≤0.5, the index of the odd-row texel at theodd U position is selected (i.e., the U position whose least significantbit is 1). Using FIG. 6A as an example, if the MSB of the interpolateddistance of a sample point is 1 (indicating that the odd-row texels areof interest) and if U₂′=U₂ mod 1≤0.5, then the sample point would fallon the left side of vertical line 642. As such, the index of the odd-rowtexel at the odd U position would be selected, in which case odd-rowtexel 628 would be selected since its U coordinate is [01]. As can beseen from the figure, odd-row texel 628 would be closer than odd-rowtexel 630 to the sample point 614.

The example discussed above describes the situation in which the samplepoint 614 is located at a position between two sets of aligned texels(e.g., between the texel pair 634 and texel pair 636), which also meansthat the four neighboring texels (e.g., 620, 622, 628, and 630) may haveunique 4-bit concatenated indices. In other words, as shown in FIG. 6A,sample point 614 is located between the pair of even-row texels 618, 620and the pair of even-row texels 622, 624, and similarly between the pairof odd-row texels 626, 628 and the pair of odd-row texels 630, 632.However, a sample point may instead be located within an aligned set of2×2 texels (e.g., within texels 618, 620, 626, 628), which means thatthe even-row texels would have identical 4-bit concatenated indices andthe odd-row texels would have identical 4-bit concatenated indices. Asan example, as shown in FIG. 6A, sample point 644 located at (U₃, V₃) islocated between the texels of the pair of even-row texels 622, 624, andsimilarly between the texels of the pair of odd-row texels 630, 632. Inthis situation, the 4 closest texels to sample point 644 would includethe pair of even-row texels 622, 624 and the pair of odd-row texels 630,632. Using the method 700 described above, after determining whether tochoose the even-row texel pair (if the interpolated distance's MSB=0) orthe odd-row texel pair (if the interpolated distance's MSB=1), selectingthe closest even-row or odd-row texel by computing whether U₃′=U₃ mod1>0.5 or ≤0.5 leads to a result that is contrary to the conceptual ideaof selecting the closest texel. As an example, if the even-row texelpair 622, 624 is selected (based on the interpolated distance's MSB=0),and it is determined that U₃′=U₃ mod 1>0.5, then the index of theeven-row texel at the even U position (i.e., the U position whose leastsignificant bit is 0) is selected. However, this would lead to theselection of the “left-side” even-row texel 622 (since its U position is10), even though conceptually the determination that U₃′>0.5 indicatesthat the “right-side” even-row texel 624 is closer. Despite thisseemingly incongruous result, because even-row texels 622 and 624 havethe same concatenated indices, the end result of which even-row texel'sindex is selected is inconsequential. In a similar manner, the sameresult would occur when selecting between the pair of odd-row texels630, 632.

Going back to FIG. 7, after determining which even-row texel or odd-rowtexel is closer to the sample point 614, at step 790, the concatenatedcolor index of the selected even-row or odd-row texel that is determinedto be the closest in distance to sample point 614 is used to determinethe color for sample point 614. As an example, if at step 760 it isdetermined that even-row texel 620 is closest in distance to samplepoint 614 (which has MSB=0), then sample point 614 is determined to becoded blue (e.g., as determined based on the assumption discussed abovethat the index of even-row texels 618 and 620 code to blue). If,instead, at step 760 it is determined that even-row texel 622 is closestin distance to sample point 614 (which has MSB=0), the sample point 614is also determined to be coded blue. On the other hand, if at step 780it is determined that odd-row texel 628 is closest in distance to samplepoint 614 (which has MSB=1), the sample point 614 is determined to becoded red. Instead, if at step 780 it is determined that odd-row texel630 is closest in distance to sample point 614 (which has MSB=1), thesample point 614 is determined to be coded as coded green. Particularembodiments may repeat one or more steps of the method of FIG. 7, whereappropriate. Although this disclosure describes and illustratesparticular steps of the method of FIG. 7 as occurring in a particularorder, this disclosure contemplates any suitable steps of the method ofFIG. 7 occurring in any suitable order. Moreover, although thisdisclosure describes and illustrates an example method for using thecoarse grain color index to determine the color of a sample positionusing single distance fields including the particular steps of themethod of FIG. 7, this disclosure contemplates any suitable method forusing the coarse grain color index to determine the color of a sampleposition using single distance fields including any suitable steps,which may include all, some, or none of the steps of the method of FIG.7, where appropriate. Furthermore, although this disclosure describesand illustrates particular components, devices, or systems carrying outparticular steps of the method of FIG. 7, this disclosure contemplatesany suitable combination of any suitable components, devices, or systemscarrying out any suitable steps of the method of FIG. 7.

As can be seen from the embodiments described above for encodingconcatenated color indices in a texel array and deducing the appropriateconcatenated color index to use based on interpolation results, adistance field label with concatenated color indices of adjacent texelscan be configured to support up to 16 colors (e.g., a “transparent”color and up to 15 unique colors). Similar to the fine grain technique,this coarse grain technique also has the advantage of using distancefields (e.g., sharpness regardless of size and/or orientation) yetmitigating the traditional drawback of having limited color options.

Using Dual Distance Field to Determine Color of a Sample Position

In particular embodiments, using single distance fields based on thedistance to only one edge may result in the sharp corners (e.g., adiamond shape) of characters or glyphs to appear rounded or smoothed-outwhen they are rendered, especially as the resolution of the distancefield decreases. A solution to this is to use dual distance fields tocapture information at the intersection between two edges. In particularembodiments, when a label (e.g., character, glyph, etc.) is created, anauthoring software that created the label may identify and label edges,such as type0 and type1 edges. Dual distance fields capture a texel'sdistances to two different types of edges to preserve intersection data.Each texel in a dual distance field label has two distance values:distance0 denotes the distance from the texel to the closest type0 edgeand distance1 denotes the distance from the texel to the closest type1edge.

As previously discussed, each distance value of a texel encodes whetherthe texel is “in” or “out” relative to the edge from which the distanceis measured. For a dual distance field texel, each of its distance valuecould be either “in” or “out,” which means that there are four “in” and“out” combinations for each texel. FIG. 8 illustrates an example regionassociated with a letter “F” 800 where two different edge-type edgesmeet at a vertex, resulting in four different regions associated withfour different combinations of being inside or outside of each of theedges. As shown in FIG. 8, A type0 edge 810 and a type1 edge 812intersect at point 614. Although the edges 810, 812 are drawn as solidlines, the entire length of each edge 810, 812 is not necessarily allvisible in the label. For example, what is shown in FIG. 8 maycorrespond to the upper-left corner of the letter “F,” with point 814being that corner, the right half of edge 812 defining the horizonaledge of the corner, and the lower half of edge 810 defining the verticaledge of the corner. The rest of edges 810 and 812 may be conceptualextensions of the actual, visible portions of those edges 810, 812,created for purposes of defining the distance values for nearby texels.If what is shown is the upper-left corner of “F,” texels that are belowedge 812 may be deemed “in” relative to edge 812 and texels that areabove edge 812 may be deemed “out” relative to edge 812. Similarly,texels that are to the right of edge 810 may be deemed “in” relative toedge 810 and texels that are to the left of edge 810 may be deemed “out”relative to edge 810. Because type0 edge 810 intersects with type1 edge812 at point 814, four different regions 816, 818, 820, and 822 areformed. The texels in each region would have a different “in” and “out”combination relative to the two edges 810, 812. For example, texels inregion 816 would have an out/out combination relative to edges 810/812,respectively; texels in region 818 would have an in/out combination;texels in region 826 would have an out/in combination, and texels inregion 830 would have an in/in combination. Like traditional singledistance field labels, traditional dual distance field labels onlysupport two colors—foreground and background. Foreground and backgroundwould each be encoded by particular combination(s) of “in” and “out.”For example, regions that are in/in would be considered to beforeground, and everything else (i.e., out/out, in/out, or out/in) wouldbe considered to be background. Using FIG. 8 as an example, for theacute angle of the letter “F” at point 814, in/in would designateforeground and the rest would bet set to background. But for one of theobtuse angles in the letter “F” (e.g., any of the interior angles formedby the letter's vertical bar and either of the two horizontal bars),out/out would need to designate background and the rest would be set toforeground to properly color the interior of “F.” Existing methods mayattempt to solve this problem using three types of edges. In contrast,the embodiments described herein solve this problem with just two typesof edges (e.g., type0 and type1).

Particular embodiments described herein expand the color options of dualdistance field fonts to beyond two and further allow each “in” and “out”combination to be assigned different colors. Using FIG. 8 as an example,region 816 is white colored, region 818 is red colored, region 820 isyellow colored, and region 822 is orange colored.

When a dual distance label is mapped to screen space, interpolation isused to determine the color for screen pixels based on the dual distancefields of the label's texels. As mentioned above, each texel may have adistance0 and a distance1 value specifying, respectively, the texel'sdistance to the closest edge0 and the closest edge1. In particularhardware implementations, each distance value may be represented by abinary value (e.g., 110111). In particular embodiments, the mostsignificant bit (MSB) of each distance value may be used to denotewhether the texel is “in” or “out” relative to the associated edge type,and the rest of the bits may indicate distance. For example, ifdistance0 is 110111, the MSB of distance0, which may be denoted byMSB(distance0), would be 0 (which denotes “out”) and the texel'sdistance from the closest edge0 would be 10111. Similarly, if distance1is 000001, the MSB(distance1)=1 and the texel's distance from theclosest edge1 would be 00001.

When distance values of texels are used in interpolation computations(e.g., bilinear interpolation) for a pixel's sample point in texturespace, the sample point will be assigned an interpolated distance0,computed based on the distance0 values of the four neighboring texels.In addition, the sample point will be assigned an interpolateddistance1, computed based on the distance1 values of the fourneighboring texels. Based on the MSB of the interpolated distance0, itcan be determined whether the sample point is “in” (if MSB=1) or “out”(if MSB=0) relative to edge type0. Similarly, based on the MSB of theinterpolated distance1, it can be determined whether the sample point is“in” (if MSB=1) or “out” (if MSB=0) relative to edge type1. As anexample, as shown in FIG. 8, sample point 824 would be associated withthe combination of “out/out” because it would have a MSB (interpolateddistance0)=0 (out) and a MSB (interpolated distance1)=0 (out), meaningthat sample point 824 is outside both the type0 edge 810 and the type1edge 812. Sample point 826 would be associated with the combination of“in/out” because it would have a MSB (interpolated distance0)=1 (in) anda MSB (interpolated distance1)=0 (out), meaning that sample point 826 isinside the type0 edge 810 but outside the type1 edge 812. Sample point828 would be associated with the combination of “out/in” because itwould have a MSB (interpolated distance0)=0 (out) and a MSB(interpolated distance1)=1 (in), meaning that sample point 828 isoutside the type0 edge 810 but inside the type1 edge 812. In addition,sample point 830 would be associated with the combination of “in/in”because it would have a MSB (interpolated distance0)=1 (in) and a MSB(interpolated distance0)=1 (in), meaning that sample point 830 is insideboth the type0 edge 810 and the type1 edge 812. In addition, similar tothe single-edge distance labels discussed above, texels determined to beoutside of the label's texel array are treated as being zero. As aresult, any sample position more than 0.5 texel outside the labelinterpolates a distance with MSB=0, resulting in a “transparent” colorto be chosen for the sample position.

In particular embodiments, once it has been determined which of the fourcombinations of “in” and “out” is associated with the sample point, acolor index can be accessed to determine the desired color for thatsample point. As will be described in further detail below, the texelswithin a region of the label may specify the desired color index foreach “in/out” combination. In particular embodiments, each distancevalue (e.g., 6 bits) may be associated with a color index (e.g., 2bits).

In particular embodiments, dual distance field labels may encode thedesired color (or foreground/background determination) for the fourcombinations of “in” and “out” using a fine grain technique or a coarsegrain technique. In a fine grain embodiment, described in further detailbelow, based on the MSB of the interpolated distance of the sample pointand the sample point's position in texture space, a color index may beselected from the nearby texels and used to determine the desired colorfor the sample point. The index value may be used to select a color froma color look-up table. For example, a two-bit color index may correspondto the color orange in a look-up table. Alternatively, the index valuemay be used to select a Boolean function (e.g., AND, OR, etc.) to beapplied to the MSB (interpolated distance0) and the MSB (interpolateddistance1) to determine whether the sample point should be associatedwith a foreground or background. For example, if the index selects anAND operation, applying such an operation to the MSBs of 1 and 0 wouldresult in 0, which may indicate that the sample point should be thebackground. On the other hand, if the index selects an OR operation,applying the operation to the MSBs of 1 and 0 would result in 1, whichmay indicate that the sample point should be the foreground. In otherwords, the index of a texel may define, for the region in which thetexel is located, how each “in”/“out” combination should be mapped tobackground or foreground.

In a coarse grain embodiment, as discussed in further detail below, theindices selected from a pair of texels may be concatenated to form alarger index value (e.g., two 2-bit indices could be concatenated toform a 4-bit index). An index that is 4-bit in size would be able topoint to 16 different colors in a color look-up table (e.g., with onetransparent and 15 colors).

Dual Distance Field Fine Grain Color Selection

The discussion of the fine grain, dual distance field color selectionmethod for a sample point will focus on the embodiment shown in FIGS. 9Aand 9B and the method described in FIG. 10. Briefly, FIG. 9A illustratesusing a fine grain color index selection method on an array of texelshaving dual distance fields. FIG. 9B illustrates example distance fieldsassociated with aligned two-by-two sets of texels used for the finegrain color index selection. In addition, FIG. 10 illustrates an examplemethod 1000 for using the fine grain color index encoded within dualdistance field texels to determine the color of a sample point.

FIG. 9A illustrates an example four-by-four array 900 of texels. Thesixteen texels in the array 900 are arranged on a texture map atpositions on a U-axis 910 and V-axis 912. In particular hardwareembodiments, U and V coordinates are specified in binary numbers,starting with 00 (corresponding to decimal value 0) and ending with 11(corresponding to decimal value 3). The circles represent texel positionin the texel array 900. A sample point 914 is selected using the processdescribed above (e.g., projecting a ray from a pixel to a surface in 3Dview space, finding the point of intersection, and mapping the point ofintersection into 2D texture space). As such, the sample point 914corresponds to a pixel in a screen, and the color to be selected forsample point 914 is determined using the fine grain color selectionmethod 1000. As shown in FIG. 10, the method 1000 may start at step1010, where the four nearest texels to sample point 914 are determined.FIG. 9A illustrates that the four nearest texels to sample point 914 arethe texels in the two-by-two texel region 916, and includes texel 918,texel 920, texel 922, and texel 924.

As shown in FIG. 9B, texels 918, 920, 922, and 924 are each associatedwith dual distance fields. In particular embodiments, each distancefield may be 8-bits long. The first distance field of a texel mayinclude a first 6-bit distance value, represented by distance0 or D₀,and a 2-bit color index. The MSB bit of distance0 may encode whether thetexel is “in” or “out” and the rest of the bits may specify the distancebetween the texel and the closest type0 edge. The second distance fieldof the same texel may include a second 6-bit distance value, representedby distance1 or D₁, and a 2-bit color index. The MSB bit of distance1may encode whether the texel is “in” or “out” and the rest of the bitsmay specify the distance between the texel and the closest type1 edge.Each color index of each of the texels 918, 920, 922, and 924 referencesan entry in a 4-entry color look-up table (e.g., the color look-up tableshown in FIG. 3B).

In particular embodiments, in each region of the texel array 900, thedesired colors for the four “in”/“out” combinations may be specified,respectively, by the four color indices of adjacent pairs of texels. Forexample, the distance0 and distance1 indices of texel 918 and thedistance0 and distance1 indices of texel 920 may indicate the desiredcolor for the region, depending on which “in”/“out” combination isassociated with the sample point 914 (to be described in further detailbelow). Thus, each index may represent the desired color index for aparticular “in”/“out” combination. In particular embodiments, what“in”/“out” combination represented by each index may be assigned inaccordance with a predetermined pattern. For example, FIG. 9Billustrates an example of the pattern for a 2×2 set of aligned texels,such as texels 918, 920, 922, and 924. As shown, texel 918's distance0index specifies the desired color for the out/out case and the distance1index specifies the desired color for the out/in case; texel 920'sdistance0 index specifies the desired color for the in/out case and thedistance1 index specifies the desired color for the in/in case; texel922's distance0 index specifies the desired color for the in/out caseand the distance1 index specifies the desired color for the in/in case;and texel 924's distance0 index specifies the desired color for theout/out case and the distance1 index specifies the desired color for theout/in case. This pattern may be repeated throughout the texel array900. For example, this pattern for the aligned 2×2 texels may berepeated by the 2×2 texels located at (U,V) coordinates (10, 00), (11,00), (10, 01), and (11, 01), the 2×2 texels located at (00, 10), (01,10), (00, 11), (01, 11), and the 2×2 texels located at (10, 10), (11,10), (10, 11), and (11, 11).

The pattern shown in FIG. 9B may be described in a variety of ways, suchas in terms of even texels and odd texels. Each texel may be referred toas an even texel or odd texel, defined in the same manner as describedabove with reference to FIGS. 3A-3B. For example, texel 918 may beconsidered as an even texel because the LSBs of its U and V coordinatesare the same (i.e., both 0 in this case). Texel 924 may also beconsidered as an even texel because the LSBs of its U and V coordinatesare also the same (i.e., both 1 in this case). In contrast, texel 920may be considered as an odd texel because the LSBs of its U and Vcoordinates are different (i.e., 1 and 0 in this case). Similarly, texel922 may be considered as an odd texel because the LSBs of its U and Vcoordinates are also different (i.e., 0 and 1 in this case). The patternshown in FIG. 9B may be described as follows: each even texel may haveits distance0 index associated with the out/out combination anddistance1 index associated with the out/in combination, and each oddtexel may have its distance0 index associated with the in/outcombination and distance1 index associated with the in/in combination.The pattern is repeated in an interleaved fashion. Within an aligned 2×2set of texels, each distance0 index is associated with either theout/out or in/out combination, and each distance1 index is associatedwith either the out/in or in/in combination. It should be noted thatalthough the in/out combination that is associated with each index mayrepeat, it does not mean that the index value itself needs to follow anyparticular pattern. For example, even though the texel 918 and the texellocated at (10, 00) may both have a distance0 index that is associatedwith the out/out combination, the distance0 index of texel 918 maycorrespond to the color red while the distance0 index of the texel at(10, 00) may correspond to the color blue.

Similar to the fine grain single distance field embodiment describedabove with reference to FIGS. 2A and 2B, the even and odd texels in thefine grain dual distance field embodiment also specify, via theirrespective indices, the desired color for their respective coverageareas. For example, the even texels specify the colors for theirrespective coverage areas (e.g., as shown in FIG. 2A) and the odd texelsspecify the colors for their respective coverage areas (e.g., as shownin FIG. 2B). As will be described in more detail below, if the MSB ofthe interpolated distance0 for sample point 914 is 0, the closest eventexel may be selected. The selected even texel has two indicesassociated with distance0 and distance1. If the MSB of the interpolateddistance1 for sample point 914 is 0, the index associated with distance0will be selected. On the other hand, if the MSB of the interpolateddistance1 is 1, the index associated with distance1 will be selected.The selected index can then be used to determine the color for thesample point 914, which is located within the coverage area of theselected even texel. As another example, if the MSB of the interpolateddistance0 for sample point 914 is 1, the closest odd texel may beselected. The selected odd texel has two indices associated withdistance0 and distance1. If the MSB of the interpolated distance1 forsample point 914 is 0, the index associated with distance0 will beselected. On the other hand, if the MSB of the interpolated distance1 is1, the index associated with distance1 will be selected. The selectedindex can then be used to determine the color for the sample point 914,which is located within the coverage area of the selected odd texel.

The final index that has been selected may then be used to determine thecolor of the sample point 914. As described above, particularembodiments of the index may specify a particular logic operation (e.g.,AND, OR, XOR, NAND, NOR, XNOR, etc.) to be applied to the MSBs of theinterpolated distance0 and distance1 values of the sample point 914. Theresult of the logic operation may indicate whether the sample point 914is a background (e.g., if the logic operation results in 0) or aforeground (e.g., if the logic operation results in 1). In otherembodiments, the selected index may point to a particular entry in acolor look-up table (e.g., FIG. 3B).

As shown in FIG. 10, at step 1012, the distance values distance0 (D₀)and distance1 (D1) for sample point 914 are interpolated based on thedistance values of each of texels 918, 920, 922, and 924. In particularembodiments, interpolated distance D₀ specifies the distance between thesample point 914 and the closest type0 edge, and interpolated distanceD₁ specifies the distance between the sample point 914 and the closesttype1 edge. Then, at step 1014, the highest order bit of theinterpolated distance value D₀ for sample point 914 is determined to beeither 0 or 1. In order words, if the MSB of the interpolated distancevalue D₀ for sample point 914 is determined to be 0, then sample point914 is determined to be “out” relative to the closest type0 edge (i.e.,outside the region defined by the closest type0 edge). On the otherhand, if the MSB of the interpolated distance value D₀ for sample point914 determined to be 1, then sample point 914 is determined to be “in”relative to the closest type0 edge (i.e., inside the region defined bythe closest type0 edge). Similarly, if the interpolated D₁=0, thensample point 914 is determined to be “out” relative to the closest type1edge; if the interpolated D₁=1, then sample point 914 is determined tobe “in” relative to the closest type1 edge.

If it is determined at step 1014 that the MSB of the interpolateddistance value D₀ for sample point 914 is 0, then at step 1016, thesample point 914 is determined to be “out” relative to the closest type0edge, and thus two even texels are selected from the two-by-two texelregion 916. The even texels are defined in the same manner as describedabove with reference to FIGS. 3A-3B. Specifically, within the two-by-twotexel region 916, texel 918 may be considered as an even texel becausethe LSBs of its U coordinate (u=00) and V coordinate (v=00) are the same(i.e., both 0 in this case), and texel 924 may also be considered as aneven texel because the LSBs of its U coordinate (u=01) and V coordinate(v=01) are also the same (i.e., both 1 in this case). Thus, texels 918and 924 are selected as the two even texels within the two-by-two texelregion 916.

Then, at step 1018, the method 1000 determines which even texel of theselected two even texels is closer in distance to the sample point 914.This is determined similar to the single distance, fine grain embodimentdescribed in FIG. 3A and step 450 of the method 400 of FIG. 4.Specifically, one way for hardware to determine which of the two eventexels is closer to the sample point 914 is by determining,conceptually, which side of a diagonal 926 the sample point 914 fallsin. This is done by summing the U-axis and V-axis distances of theinterpolated distance value D₀ of the sample point 914. Thus, for thetwo-by-two texel region 916, any point on or to the left of diagonal 926would have its U-axis and V-axis distances sum up to 1 distance unit orless (in this example, a point falling on the diagonal is being countedas being on closer to the left texel). If so, then the indices of eventexel 918 (e.g., including the distance0 index and the distance1 index)would be deemed to be closer to the sample point 914 and, therefore,selected. Conversely, any point to the right of diagonal 926 would haveits U-axis and V-axis distances sum up to greater than 1 distance unit.If so, then the indices of texel 924 (e.g., including the distance0index and the distance1 index) would be deemed to be closer to thesample point 914 and, therefore, selected. As an example, if the samplepoint 914 is determined to be to the left of diagonal 926, then theindices of even texel 918 (e.g., including the distance0 index and thedistance1 index) would be selected.

Since two indices, the distance0 index and the distance1 index, areassociated with the even texel 918, the method 1000 next determineswhich index of even texel 918 to use. To make this determination, atstep 1020, the method 1000 determines whether the highest order bit ofthe interpolated distance value D₁ for sample point 914 is either 0or 1. As such, if it is determined at step 1020 that the MSB of theinterpolated distance value D₁ for sample point 914 is 0, the samplepoint 914 is determined to be “out” relative to the closest type1 edge,and at step 1022, the index associated with distance0 of the selectedeven texel will be selected to determine the color of sample point 914.On the other hand, if it is determined at step 1020 that the MSB of theinterpolated distance value D₁ for sample point 914 is 1, the samplepoint 914 is determined to be “in” relative to the closest type1 edge,and at step 1024, the index associated with distance1 of the selectedeven texel will be selected to determine the color of sample point 914.As discussed above, in particular embodiments, the final index selectedmay then be used to determine the color of the sample point 914 based onthe particular logic operation specified by the index to indicatewhether the sample point 914 is a background (e.g., if the logicoperation results in 0) or a foreground (e.g., if the logic operationresults in 1). In other embodiments, the selected index may point to aparticular entry in a color look-up table similar to that describedabove in relation to FIG. 3B. As an example, if the sample point 914 isdetermined to be closer in distance to the even texel 918, and the MSBof the interpolated distance value D₁ for sample point 914 is determinedto be 0, then the index associated with distance0 of the even texel 918will be selected to determine the color of sample point 914. ReferencingFIG. 3B, if the 2-bit index of distance0 encodes for “3,” then samplepoint 914 is determined to be coded blue.

On the other hand, if it is determined at step 1014 that the MSB of theinterpolated distance value D₀ for sample point 914 is 1, then at step1026, the sample point 914 is determined to be “in” relative to theclosest type0 edge, and thus two odd texels are selected from thetwo-by-two texel region 916. The odd texels are defined in the samemanner as described above with reference to FIGS. 3A-3B. Specifically,within the two-by-two texel region 916, texel 920 may be considered asan odd texel because the LSBs of its U coordinate (u=01) and Vcoordinate (v=00) are different (i.e., 1 and 0 in this case), and texel922 may also be considered as an odd texel because the LSBs of its Ucoordinate (u=00) and V coordinate (v=01) are also different (i.e., 0and 1 in this case). Thus, texels 920 and 922 are selected as the twoodd texels within the two-by-two texel region 916.

Then, at step 1028, the method 1000 determines which odd texel of theselected two odd texels is closer in distance to the sample point 914.This is determined similar to the embodiment described in FIG. 3A andstep 470 of the method 400 of FIG. 4. Specifically, one way for hardwareto determine which of the two odd texels is closer to the sample point914 is by determining, conceptually, which side of a diagonal 928 thesample point 914 falls in. This is done by summing the U-axis and V-axisdistances of the interpolated distance value D₀ of the sample point 914.Thus, for the two-by-two texel region 916, any point on or to the leftof diagonal 928 would have its U-axis and V-axis distances sum up to 1distance unit or less (in this example, a point falling on the diagonalis being counted as being on closer to the left texel). If so, then theindices of odd texel 922 (e.g., including the distance0 index and thedistance1 index) would be deemed to be closer to the sample point 914and, therefore, selected. Conversely, any point to the right of diagonal928 would have its U-axis and V-axis distances sum up to greater than 1distance unit. If so, then the indices of texel 920 (e.g., including thedistance0 index and the distance1 index) would be deemed to be closer tothe sample point 914 and, therefore, selected. As an example, if thesample point 914 is determined to be to the left of diagonal 928, thenthe indices of odd texel 922 (e.g., including the distance0 index andthe distance1 index) would be selected.

Since two indices, the distance0 index and the distance1 index, areassociated with the odd texel 922, the method 1000 next determines whichindex of odd texel 922 to use. To make this determination, at step 1030,the method 1000 determines whether the highest order bit of theinterpolated distance value D₁ for sample point 914 is either 0 or 1. Assuch, if it is determined at step 1030 that the MSB of the interpolateddistance value D₁ for sample point 914 is 0, the sample point 914 isdetermined to be “out” relative to the closest type1 edge, and at step1032, the index associated with distance0 of the selected odd texel willbe selected to determine the color of sample point 914. On the otherhand, if it is determined at step 1030 that the MSB of the interpolateddistance value D₁ for sample point 914 is 1, the sample point 914 isdetermined to be “in” relative to the closest type1 edge, and at step1034, the index associated with distance1 of the selected odd texel willbe selected to determine the color of sample point 914. As discussedabove, in particular embodiments, the final index selected may then beused to determine the color of the sample point 914 based on theparticular logic operation specified by the index to indicate whetherthe sample point 914 is a background (e.g., if the logic operationresults in 0) or a foreground (e.g., if the logic operation results in1). In other embodiments, the selected index may point to a particularentry in a color look-up table similar to that described above inrelation to FIG. 3B. As an example, if the sample point 914 isdetermined to be closer in distance to the odd texel 922, and the MSB ofthe interpolated distance value D₁ for sample point 914 is determined tobe 0, then the index associated with distance0 of the odd texel 922 willbe selected to determine the color of sample point 914. Referencing FIG.3B, if the 2-bit index of distance0 encodes for “1,” then sample point914 is determined to be coded red.

As can be seen from the embodiments described above for encoding colorindices in a texel array using two distance fields and deducing theappropriate color index to use based on interpolation results, dualdistance field labels can be configured to support more than two colors.Dual distance fields can be used to capture color information at theintersection between two edges to help preserve intersection data andbetter render the sharp corners of characters or glyphs.

Dual Distance Field Coarse Grain Color Selection

The discussion of the coarse grain, dual distance field color selectionmethod for a sample point will focus on the embodiment shown in FIGS.11A-11B and the method described in FIG. 12. Briefly, FIG. 11Aillustrates using a coarse grain color index selection method on anarray of texels having dual distance fields. FIG. 11B illustratesexample distance fields associated with aligned two-by-two sets oftexels used for the coarse grain color index selection. In addition,FIG. 12 illustrates an example method for using the coarse grain colorindex encoded with dual distance field texels to determine the color ofa sample point.

FIG. 11A illustrates an example four-by-four array 1100 of texels. Thesixteen texels in the array 1100 are arranged on a texture map atpositions on a U-axis 1110 and V-axis 1112. In particular hardwareembodiments, U and V coordinates are specified in binary numbers,starting with 00 (corresponding to decimal value 0) and ending with 11(corresponding to decimal value 3). The circles represent texelpositions in the texel array 1100. A sample point 1114 is selected(similar to how sample point 914 is selected above), and the color to beselected for sample point 1114 is determined using the coarse graincolor selection method 1200, as discussed below.

The coarse grain, dual distance field color selection method 1200differs, in at least one aspect, from the fine grain, dual distancefield color selection method 1000 in that the coarse grain, dualdistance field color selection method uses a pair of texels, rather thana single texel, to specify the desired color index for a regionsurrounding the texel pair (e.g., by concatenating the indices of eachpair of horizontally aligned texels). As a result, the coverage area ofeach texel pair is larger than the coverage area of each texel used inthe fine grain method. The benefit of using a pair of texels to encodethe color index is that the number of bits available for encoding theindex increases (e.g., from 2 bits to 4 bits), which means that morecolor options are available (e.g., from 4 to 16 colors). Since the firstcolor table entry is typically set to transparent (i.e., no color), thisleaves up to 15 unique colors that can be encoded by the 4-bit indexused in the coarse grain, dual distance field color selection method.

As discussed above, for a dual distance field texel, each texel may havea distance0 and a distance1 value specifying, respectively, the texel'sdistance to the closest edge0 and the closest edge1. In addition, eachof its distance value could be either “in” or “out,” which means thatthere are four “in” and “out” combinations for each texel. In particularembodiments, as discussed in more detail below, dual distance fieldlabels may encode for a desired color, or a foreground/backgrounddetermination, for the four combinations of “in” and “out” using acoarse grain technique. In the coarse grain technique, the indicesselected from a pair of texels may be concatenated to form a largerindex value (e.g., two 2-bit indices could be concatenated to form a4-bit index). In the dual distance field embodiment, each texel has twocolor indices: one associated with distance0 and the other associatedwith distance1. In particular embodiments, corresponding indices of thetwo aligned pairs of texels are concatenated together. For example,texel 1118 may have an index associated with distance0 and another indexassociated with distance 1; similarly, texel 1120 may have an indexassociated with distance0 and another index associated with distance 1.The respective distance0 indices of texels 1120 and 1118 may beconcatenated to form a single 4-bit index associated with distance 0.Similarly, the respective distance1 indices of texels 1118 and 1120 maybe concatenated to form a single 4-bit index associated with distance1.The resulting distance0 4-bit index and the distance1 4-bit index mayboth be stored with texels 1118 and 1120 so that they both have copiesof the indices. As mentioned above, an index that is 4-bit in size wouldbe able to point to 16 different colors in a color look-up table (e.g.,with one transparent and 15 colors).

As shown in FIG. 12, the method 1200 may start at step 1210, where theindices of adjacent pairs of even-row or odd-row texels are concatenatedand stored with both associated texels in the texel buffer in the pixelblock. Similar to the embodiment described in relation to FIGS. 5A, 5B,and 6A, the pairs of texels in each even row (e.g., determined based onthe least significant bit of the V position of the even texel being 0)may be used to encode the color index for the “out” case, and the pairsof texels in each odd row (e.g., determined based on the leastsignificant bit of the V position of the odd texel being 1) may be usedto encode the color index for the “in” case. To summarize, “even-rowtexel” refers to a texel on an even row of the texel array (e.g., theleast significant bit of the V position of an even-row texture is 0),and “odd-row texel” refers to a texel on an odd row of the texel array(e.g., the least significant bit of the V position of an odd-row textureis 1). As an example, in FIG. 11A, texels 1118, 1120, 1122, and 1124(all have v=00) are even-row texels, and texels 1126, 1128, 1130, and1132 (all have v=01) are odd-row texels.

As shown in FIG. 11B, texels 1118, 1120, 1126, and 1128 are eachassociated with dual distance fields with concatenated indices. Inparticular embodiments, each texel may have a first distance field thatincludes a first 6-bit distance value, represented by distance0 or D₀,and an associated 4-bit concatenated color index, and a second distancefield that also includes a first 6-bit distance value, represented bydistance1 or D₁, and an associated 4-bit concatenated color index. TheMSB bit of distance0 may encode whether the texel is “in” or “out” andthe rest of the bits may specify the distance between the texel and theclosest type0 edge. In addition, the MSB bit of distance1 may encodewhether the texel is “in” or “out” and the rest of the bits may specifythe distance between the texel and the closest type1 edge. Eachconcatenated color index of each of the texels 1118, 1120, 1126, and1128 references an entry in a 16-entry color look-up table (e.g., thecolor look-up table shown in FIG. 6B).

In particular embodiments, in each region of the texel array 1100, thedesired colors for the four “in”/“out” combinations may be specified,respectively, by the two concatenated color indices of adjacent pairs oftexels. For example, the distance0 concatenated index of texel 1118,which is generated by concatenating the distance0 indices of texel 1118and texel 1120, may indicate the desired color for the region covered bythe pair of texels 1118, 1120, depending on which “in”/“out” combinationis associated with the sample point 1114 (to be described in furtherdetail below). In addition, the distance1 concatenated index of texel1118, which is generated by concatenating the distance0 indices of texel1118 and texel 1120, may also indicate the desired color for the sameregion depending on which “in”/“out” combination is associated with thesample point 1114 (the “in”/“out” combination associated with thedistance1 concatenated index would be different from that of thedistance0 concatenated index). In other words, the two concatenatedindices of each texel may represent the desired color index for twodifferent “in”/“out” combinations, one associated with distance0 andanother associated with distance1. In particular embodiments, which two“in”/“out” combinations are represented by the two concatenated indicesof each texel may be assigned in accordance with a predeterminedpattern.

As an example, FIG. 11B illustrates an example of the pattern for a 2×2set of aligned texels, such as a first set of texels 1118, 1120, 1126,and 1128, and similarly, a second set of texels 1122, 1124, 1130, and1132. As shown, the concatenated index for distance0 of the even-rowtexels 1118 and 1120 (which is identical for both texels) specifies thedesired color for the out/out case and the concatenated index fordistance1 specifies the desired color for the out/in case. In addition,concatenated index for distance0 of the odd-row texels 1126 and 1128(which is identical for both texels) specifies the desired color for thein/out case and the concatenated index for distance1 specifies thedesired color for the in/in case. Similarly, this pattern may berepeated for adjacent texels 1122, 1124 and texels 1130, 1132. Forexample, the concatenated index for distance0 of the even-row texels1122 and 1124 (which is identical for both texels) specifies the desiredcolor for the out/out case and the concatenated index for distance1specifies the desired color for the out/in case. In addition,concatenated index for distance0 of odd-row texels 1130 and 1132 (whichis identical for both texels) specifies the desired color for the in/outcase and the concatenated index for distance1 specifies the desiredcolor for the in/in case. Moreover, this pattern may be repeated throughthe rest of texel array 1100. For example, this pattern for the aligned2×2 texels may be repeated by the 2×2 texels located at (U,V)coordinates (00, 10), (01, 10), (00, 11), and (01, 11), and the 2×2texels located at (10, 10), (11, 10), (10, 11), and (11, 11).

The pattern shown in FIG. 11B may be described in a variety of ways,such as in terms of even-row texels and odd-row texels. Each texel maybe referred to as an even-row texel or odd-row texel, defined in thesame manner as described above with reference to FIGS. 5A-5B. Forexample, as discussed above, even-row texels are located at V positionv=00 (“even” since its LSB is 0) and thus would include texels 1118,1120, 1122, and 1124. Of these four even-row texels, the two indices ofthe pair of adjacent even-row texels 1118 and 1120 are concatenated andthe result is associated with the concatenated indices of both even-rowtexels, and the pair of adjacent even-row texels 1122 and 1124 areconcatenated and the result is associated with the concatenated indicesof both even-row texels. Likewise, odd-row texels are located at Vposition v=01 (“odd” since its LSB is 1) and thus would include texels1126, 1128, 1130, and 1132. Of these four odd-row texels, the twoindices of the pair of adjacent odd-row texels 1126 and 1128 areconcatenated and the result is associated with the concatenated indicesof both odd-row texels, and the two indices of the pair of adjacentodd-row texels 1130 and 1132 are concatenated and the result isassociated with the concatenated indices of both odd-row texels.

The pattern shown in FIG. 11B may be described as follows: each even-rowtexel may have its concatenated distance0 index associated with theout/out combination and concatenated distance1 index associated with theout/in combination, and each odd-row texel may have its concatenateddistance0 index associated with the in/out combination and concatenateddistance1 index associated with the in/in combination. The pattern isrepeated in an interleaved fashion. Within an aligned 2×2 set of texels,each distance0 index is associated with either the out/out or in/outcombination, and each distance1 index is associated with either theout/in or in/in combination. It should be noted that although the in/outcombination that is associated with each concatenated index may repeat,it does not mean that the index value itself needs to follow anyparticular pattern. For example, even though the texel 1118 and thetexel located at (00, 10) may both have a distance0 index that isassociated with the out/out combination, the distance0 index of texel1118 may correspond to the color red while the distance0 index of thetexel at (00, 10) may correspond to the color blue.

Similar to the coarse grain single distance field embodiment describedabove with reference to FIGS. 5A and 5B, the even and odd-row texels inthe coarse grain dual distance field embodiment also specify, via theirrespective indices, the desired color for their respective coverageareas. For example, the even-row texels specify the colors for theirrespective coverage areas (e.g., as shown in FIG. 5A) and the odd-rowtexels specify the colors for their respective coverage areas (e.g., asshown in FIG. 5B). As will be described in more detail below, if the MSBof the interpolated distance0 for sample point 1114 is 0, the closesteven-row texel may be selected. The selected even-row texel has twoconcatenated indices associated with distance0 and distance1. If the MSBof the interpolated distance1 for sample point 1114 is 0, theconcatenated index associated with distance0 will be selected. On theother hand, if the MSB of the interpolated distance1 is 1, theconcatenated index associated with distance1 will be selected. Theselected concatenated index can then be used to determine the color forthe sample point 1114, which is located within the coverage area of theselected even-row texel. As another example, if the MSB of theinterpolated distance0 for sample point 1114 is 1, the closest odd-rowtexel may be selected. The selected odd-row texel has two concatenatedindices associated with distance0 and distance1. If the MSB of theinterpolated distance1 for sample point 1114 is 0, the concatenatedindex associated with distance0 will be selected. On the other hand, ifthe MSB of the interpolated distance1 is 1, the concatenated indexassociated with distance1 will be selected. The selected concatenatedindex can then be used to determine the color for the sample point 1114,which is located within the coverage area of the selected odd-row texel.

The final index that has been selected may then be used to determine thecolor of the sample point 1114. As described above, particularembodiments of the concatenated index may specify a particular logicoperation (e.g., AND, OR, XOR, NAND, NOR, XNOR, etc.) to be applied tothe MSBs of the interpolated distance0 and distance1 values of thesample point 1114. The result of the logic operation may indicatewhether the sample point 914 is a background (e.g., if the logicoperation results in 0) or a foreground (e.g., if the logic operationresults in 1). In other embodiments, the selected concatenated index maypoint to a particular entry in a color look-up table with up to 16different entries (e.g., FIG. 6B).

Returning to the method 1200 shown in FIG. 12, at step 1212, the fournearest texels to sample point 1114 are determined. FIG. 11A illustratesthat the four nearest texels to sample point 1114 are texel 1120, texel1122, texel 1128, and texel 1130. Then, at step 1214, the distancevalues distance0 (D₀) and distance1 (D₁) for sample point 1114 areinterpolated based on the corresponding distance0 and distance1 valuesof each of texels 1120, 1122, 1128, and 1130. In particular embodiments,the interpolated distance D₀ specifies the distance between the samplepoint 1114 and the closest type0 edge, and the interpolated distance D₁specifies the distance between the sample point 1114 and the closesttype1 edge. Next, at step 1216, the highest order bit of theinterpolated distance value D₀ for sample point 1114 is determined to beeither 0 or 1. In order words, if the MSB of the interpolated distancevalue D₀ for sample point 1114 is determined to be 0, then sample point1114 is determined to be “out” relative to the closest type0 edge (i.e.,outside the region defined by the closest type0 edge). On the otherhand, if the MSB of the interpolated distance value D₀ for sample point1114 determined to be 1, then sample point 914 is determined to be “in”relative to the closest type0 edge (i.e., inside the region defined bythe closest type0 edge).

If it is determined at step 1216 that the MSB of the interpolateddistance value D₀ for sample point 1114 is 0, then at step 1218, thesample point 1114 is determined to be “out” relative to the closesttype0 edge, and thus two even-row texels are selected from the closesttwo-by-two texel region 1116. The even-row texels are defined in thesame manner as described above with reference to FIGS. 5A-5B.Specifically, within the two-by-two texel region 1116, texels 1120 and1122 may be considered as even-row texels because the LSBs of their Vcoordinate equals 0. Thus, in this example where the MSB of theinterpolated distance D₀ is 0, texels 1120 and 1122 are selected.

Then, at step 1220, the method 1200 determines which of the selected twoeven-row texels is closer in distance to the sample point 1114. This isdetermined similar to the single distance, coarse grain embodimentdescribed in FIG. 6A and step 760 of the method 700 of FIG. 7.Specifically, one way for hardware to determine which of the twoeven-row texels is closer to sample point 1114 is by determining,conceptually, which side of the vertical line 1134 the sample point 1114falls on (e.g., by determining whether the sample point 1114 is lessthan or equal to 0.5 texels, or alternatively, greater than 0.5 texels,from the closest integer U-axis position, as discussed above). As anexample, for the even-row texels 1120 and 1122, any point on or to theleft of vertical line 1134 would have a distance from a closest integerU-axis position (e.g., u=01) that is less than or equal to 0.5 texels.If so, then the concatenated indices (e.g., including the concatenateddistance0 index and the concatenated distance1 index) of even-row texel1120 (i.e., the “left” even-row texel) would be deemed closer to thesample point 1114, and therefore, tentatively selected. Conversely, anypoint to the right of vertical line 1134 would have a distance from theclosest integer U-axis position (e.g., u=01) than is greater than 0.5texels. If so, then the concatenated indices (e.g., including theconcatenated distance0 index and the concatenated distance1 index) ofeven-row texel 1122 (i.e., the “right” even-row texel) would be deemedcloser to sample point 1114, and therefore, tentatively selected.

Since two concatenated indices, the concatenated distance0 index and theconcatenated distance1 index, are associated with the even-row texel1120, the method 1200 next determines which concatenated index ofeven-row texel 1120 to use. To make this determination, at step 1222,the method 1200 determines whether the highest order bit of theinterpolated distance value D₁ for sample point 1114 is either 0 or 1.If it is determined at step 1222 that the MSB of the interpolateddistance value D₁ for sample point 1114 is 0, the sample point 1114 isdetermined to be “out” relative to the closest type1 edge, and at step1224, the concatenated index associated with distance0 of the selectedeven-row texel 1120 will be selected to determine the color of samplepoint 1114. On the other hand, if it is determined at step 1122 that theMSB of the interpolated distance value D₁ for sample point 1114 is 1,the sample point 1114 is determined to be “in” relative to the closesttype1 edge, and at step 1224, the concatenated index associated withdistance1 of the selected even-row texel 1120 will be selected todetermine the color of sample point 1114. As discussed above, inparticular embodiments, the final index selected may then be used todetermine the color of the sample point 1114 based on the particularlogic operation specified by the index to indicate whether the samplepoint 1114 is a background (e.g., if the logic operation results in 0)or a foreground (e.g., if the logic operation results in 1). In otherembodiments, the selected index may point to a particular entry in acolor look-up table similar to that described above in relation to FIG.6B. As an example, if the sample point 1114 is determined to be closerin distance to the even-row texel 1120, and the MSB of the interpolateddistance value D₁ for sample point 1114 is determined to be 0, then theindex associated with distance0 of the even-row texel 1120 will beselected to determine the color of sample point 1114. Referencing FIG.6B, if the 4-bit concatenated index of distance0 encodes for “3,” thensample point 1114 is determined to be coded blue.

On the other hand, if it is determined at step 1216 that the MSB of theinterpolated distance value D₀ for sample point 1114 is 1, then at step1228, the sample point 114 is determined to be “in” relative to theclosest type0 edge, and thus two odd-row texels are selected from thetwo-by-two texel region 1116. The odd-row texels are defined in the samemanner as described above with reference to FIGS. 5A-5B. Specifically,within the two-by-two texel region 1116, texels 1128 and 1130 may beconsidered as odd-row texel because the LSBs of its V coordinate are 1.Thus, texels 1128 and 1130 are selected as the two odd-row texels withinthe two-by-two texel region 1116.

Then, at step 1230, the method 1200 determines which odd-row texel ofthe selected two odd-row texels is closer in distance to the samplepoint 1114. This is determined similar to the embodiment described inFIG. 6A and step 780 of the method 700 of FIG. 7. Specifically, similarto the determination for even-row texels described above, one way forhardware to determine which of the two odd-row texels is closer tosample point 1114 is by determining, conceptually, which side of thevertical line 1134 the sample point 1114 falls on (e.g., by determiningwhether the sample point 1114 is less than or equal to 0.5 texels, oralternatively, greater than 0.5 texels, from the closest integer U-axisposition, as discussed above). As an example, for the odd-row texels1128 and 1130, any point on or to the left of vertical line 1134 wouldhave a distance from a closest integer U-axis position (e.g., u=01) thatis less than or equal to 0.5 texels. If so, then the concatenatedindices (e.g., including the concatenated distance0 index and theconcatenated distance1 index) of odd-row texel 1128 (i.e., the “left”odd-row texel) would be deemed closer to the sample point 1114, andtherefore, tentatively selected. Conversely, any point to the right ofvertical line 1134 would have a distance from the closest integer U-axisposition (e.g., u=01) than is greater than 0.5 texels. If so, then theconcatenated indices (e.g., including the concatenated distance0 indexand the concatenated distance1 index) of odd-row texel 1130 (i.e., the“right” odd-row texel) would be deemed closer to sample point 1114, andtherefore, tentatively selected.

Since two concatenated indices, the concatenated distance0 index and theconcatenated distance1 index, are associated with the odd-row texel1128, the method 1200 next determines which concatenated index ofodd-row texel 1128 to use. To make this determination, at step 1232, themethod 1000 determines whether the highest order bit of the interpolateddistance value D₁ for sample point 1114 is either 0 or 1. If it isdetermined at step 1232 that the MSB of the interpolated distance valueD₁ for sample point 1114 is 0, the sample point 1114 is determined to be“out” relative to the closest type1 edge, and at step 1234, theconcatenated index associated with distance0 of the selected odd-rowtexel will be selected to determine the color of sample point 1114. Onthe other hand, if it is determined at step 1232 that the MSB of theinterpolated distance value D₁ for sample point 1114 is 1, the samplepoint 1114 is determined to be “in” relative to the closest type1 edge,and at step 1236, the concatenated index associated with distance1 ofthe selected odd-row texel will be selected to determine the color ofsample point 1114. As discussed above, in particular embodiments, thefinal index selected may then be used to determine the color of thesample point 1114 based on the particular logic operation specified bythe concatenated index to indicate whether the sample point 1114 is abackground (e.g., if the logic operation results in 0) or a foreground(e.g., if the logic operation results in 1). In other embodiments, theselected concatenated index may point to a particular entry in a colorlook-up table similar to that described above in relation to FIG. 6B. Asan example, if the sample point 1114 is determined to be closer indistance to the odd-row texel 1128, and the MSB of the interpolateddistance value D₁ for sample point 1114 is determined to be 0, then theconcatenated index associated with distance0 of the odd-row texel 1128will be selected to determine the color of sample point 1114.Referencing FIG. 6B, if the 4-bit concatenated index of distance0encodes for “1,” then sample point 1114 is determined to be coded red.

The example discussed above describes the situation in which the samplepoint 1114 is located at a position between two sets of aligned texels(e.g., the first set includes texels 1118, 1120, 1126, and 1128 and thesecond set includes texels 1122, 1124, 1130, and 1132), which also meansthat the four neighboring texels (e.g., 1120, 1122, 1128, and 1130) mayhave unique 4-bit concatenated indices. In other words, as shown in FIG.11A, sample point 1114 is located between the pair of even-row texels1118, 1120 and the pair of even-row texels 1122, 1124, and similarlybetween the pair of odd-row texels 1126, 1128 and the pair of odd-rowtexels 1130, 1132. However, a sample point may instead be located withinan aligned set of 2×2 texels (e.g., within texels 1118, 1120, 1126,1128), which means that the even-row texels (e.g., 1118 and 1120) wouldhave identical 4-bit concatenated indices and the odd-row texels (e.g.,1126 and 1128) would have identical 4-bit concatenated indices. As anexample, assume there is a sample point located at (U₃, V₃) between thetexels of the pair of even-row texels 1118, 1120, and between the texelsof the pair of odd-row texels 1126, 1128. In this situation, the 4closest texels to the sample point would include the texels 1118, 1120,1126, and 1128. Using the method 1200 described above, after determiningwhether to choose the even-row texel pair (if the interpolateddistance0's MSB=0) or the odd-row texel pair (if the interpolateddistance0's MSB=1), selecting the closest even-row or odd-row texel bycomputing whether U₃′=U₃ mod 1>0.5 or ≤0.5 leads to a result that iscontrary to the conceptual idea of selecting the closest texel. As anexample, if the even-row texel pair 1118, 1120 is selected (based on theinterpolated distance0's MSB=0), and it is determined that U₃′=U₃ mod1>0.5, then the index of the even-row texel at the even U position(i.e., the U position whose least significant bit is 0) is selected.However, this would lead to the selection of the “left-side” even-rowtexel 1118 (since its U position is 00), even though conceptually thedetermination that U₃′>0.5 indicates that the “right-side” even-rowtexel 1120 is closer. Despite this seemingly incongruous result, becauseeven-row texels 1118 and 1120 have the same concatenated indices, theend result of which even-row texel's index is selected isinconsequential. In a similar manner, the same result would occur whenselecting between the pair of odd-row texels 1126, 1128.

As can be seen from the embodiments described above for encodingconcatenated color indices in a texel array using two distance fieldsand deducing the appropriate color index to use based on interpolationresults, dual distance field labels with concatenated color indices ofadjacent texels can be configured to support up to 16 colors (e.g., a“transparent” color and up to 15 unique colors). Similar to the finegrain, dual distance field technique, this coarse grain, dual distancefields technique can be used to capture color information at theintersection between two edges to help preserve intersection data andbetter render the sharp corners of characters or glyphs.

Distance-Field Optimization Techniques

Mixed Distance Field Mipmap

Particular embodiments of distance field labels may produce suboptimalresults in certain scenarios. For example, the distance field labelsdescribed above are ideally used when the horizontal and verticaldistances between edges are at least two texels, and diagonal distancesare either square-root-of-2 texels (for fine grain index) or two timesthe square-root-of-2 texels (for coarse grain index). When suchcharacteristics are satisfied, distance filed labels may produce qualityrendering with respect to sharpness, accuracy, and minimal distortionand artifacts (e.g., pixelation, etc.). However, when the distancebetween two edges is below two texels, there is an inherent ambiguity asto which edge is measured by the distance value of a texel locatedbetween those edges. In such a scenario, the rendered label may besubject to pixilation artifacts that, in turn, could cause motionartifacts to appear.

Particular embodiments described herein relate to a robust mipmap for alabel texture that can accommodate different scaling requirements,including those where the distance between two edges in the label isless than two texels wide. The mipmap may include different mipmaplevels, each of which corresponding to a particular resolution of thelabel texture. In particular embodiments, an original high-resolutionlabel may be used to generate a series of labels with differentresolution. For example, the original label may be filtered (e.g., usingbilinear interpolation) to generate one or more lower-resolution labels.

FIG. 13 illustrates an example mipmap 1300 for a particular labeltexture. The mipmap 1300 includes a plurality of mipmap levels, eachcorresponding to the label at a different resolution. For example, thelargest mipmap level 1310 may have a resolution of 256×256 texels. Therest of the mipmap levels may have progressively lower resolutions(e.g., with each dimension in powers of 2), such as 128×128 texels(mipmap level 1320), 64×64 texels (mipmap level 1330), 32×32 texels(mipmap level 1340), 16×16 texels (mipmap level 1350), and so on. Themipmap level chosen for sampling the color of a pixel may be based onthe ratio between the size of a texel and the size of a sample pixel intexture space. For example, when selecting a mipmap level, the renderingsystem may determine the texel-to-pixel ratio for a projected pixel todetermine what mipmap level to use. In particular embodiments, themipmap level chosen is the one with texels that are similar in size tothe sampling pixels (in other words, the texel-to-pixel ratio is closestto 1). The texture map at the selected mipmap level is then sampled todetermine the color to be used. For example, initially, a labeldisplayed to the user may be generated from a 64×64 mipmap level. Whenthe user zooms out, the label would appear smaller, and as such a lowerresolution mipmap level (e.g., 8×8) may be selected to generate thelabel. However, as described above, when the resolution of a labeltexture decreases to a certain extent such that the distance between twoedges of the label (e.g., the width of the letter “I”) is less than twotexels, the rendering result would be suboptimal.

To address the aforementioned issues with distance field labels,particular embodiments may generate a mipmap for a label with two typesof mipmap levels: mipmap level(s) defined using distance fields andmipmap level(s) defined using RGBA. For example, one or morehigher-resolution mipmap levels may be defined using distance fieldtextures and one or more lower-resolution mipmap levels may be definedusing RGBA textures. Such a mipmap leverages the benefits afforded bydistance fields (e.g., sharper rendered labels with less distortion andartifacts) while eliminating the aforementioned shortcomings of distancefields at lower resolutions. In particular, when the distance betweentwo edges in a label is greater than or equal to two texels, then usingthe mipmap levels defined by distance fields for label rendering wouldprovide quality results. However, as discussed above, when the distancebetween two edges is less than two texels, the mipmap levels defined byRGBA components, rather than distance fields, may be used for rendering.Although RGBA labels at higher resolutions do not perform as well asdistance field labels (since edges in RGBA textures are prone toblurring when interpolated), they are more suitable than distance fieldlabels at lower resolutions. The problem of using distance fields whenthe features are too narrow is aliasing: edges could be skippedentirely, resulting in pixilation artifacts. Although switching to RGBAwould replace the pixilation artifacts with something that may appearblurry on close inspection, the blurriness is introduced where thefeature details are too small to be noticeable.

In particular embodiments, a label that is processed by a renderingsystem or display engine may be associated with attributes that indicatethe number of mipmap levels in its mipmap that are implemented usingdistance fields and the number of mipmap levels that are defined inRGBA. For example, if a label has four mipmap levels, a two-bitattribute may specify the number of high-resolution mipmap levels thatare defined using distance fields. For example, a two-bit attribute of10, corresponding to the decimal number 2, would indicate that the twohigher-resolution mipmap levels are defined using distance fields. Therest of the lower-resolution mipmap levels would be deemed to be definedin RGBA. Continuing the example above, since the two-bit attributeindicates that two of the four mipmap levels are defined by distancefields, the remaining two lower-level mipmap levels would be defined inRGBA. Although the mipmap levels defined in RGBA may introduce someunwanted artifacts when rendered, their visual impact on the overallscene would likely be minimal and unnoticeable since their screencoverage area would likely be small (which is why the lower-resolutionmipmap level was chosen in the first place).

Using this attribute information, a display engine may render a label asfollows. The display engine may load a 3D surface definition into memoryand perform visibility tests to determine which parts of the 3D surfaceis visible to which pixels on the screen. In particular embodiments,this primary visibility test may be performed using ray casting. Forexample, based on the user's viewpoint, a conceptual ray may be castfrom a particular pixel of a screen positioned in 3D view space and intothe view space in which the 3D surface is positioned. The intersectionbetween the ray and the 3D surface may indicate that the point ofintersection is visible through the pixel, and therefore the pixel'scolor would depend on the texture corresponding to the point ofintersection. Thus, once the point of intersection in 3D space isdetermined, it is transformed into 2D texture space of the textureassociated with the surface to determine which portion of the texture tosample. In other embodiments, instead of casting individual rays perpixels, a ray bundle may be cast for a tile of pixels (e.g., a tile maybe 16×16 pixels). In particular, the ray bundle may be cast from thefour corners of the tile, which is conceptually similar to projectingthe tile into 3D space to determine whether and where it intersects withthe surface. The area of intersection is then transformed from 3D spaceinto 2D texture space. Since a tile represents, e.g., 16×16 pixels, thesame number of 16×16 sample points will be determined within the area ofintersection in texture space.

When sampling, the display engine may determine which mipmap level touse for sampling. In particular embodiments, the display engine mayselect the mipmap level whose texels are most similar in size to thesampling pixel size (e.g., with a texel-to-pixel ratio that is closestto one-to-one). The display engine may then determine whether theselected mipmap level is defined using distance fields or RGBA. Forexample, in embodiments where each surface has a two-bit (or any otherbit size) attribute value indicating the number of mipmap levels in itsmipmap that are defined using distance fields (or RGBA), the system maydeduce whether the selected mipmap level is defined by distance field orRGBA. For example, if the selected mipmap level is 1 (e.g., the levelsmay range from 0 to 3, with 0 being the highest-resolution mipmap leveland with 3 being the lowest), the display engine may conclude that it isdefined using distance fields since the two-bit attribute indicates thatthe two highest-resolution mipmap levels correspond to distance fieldtextures. Using the same logic, if the selected mipmap level is 2, thedisplay engine may conclude that the corresponding texture is definedusing RGBA. Once the display engine determines which type of texture itis using, it may invoke the appropriate rendering logic to handle thesubsequent sampling process. For example, for distance field labels, theaforementioned process for single distance filed or dual distance fieldfiltering process may be used to determine the colors of the samplingpoints. For RGBA labels, the display engine may identify the fournearest texels to the sampling point and perform bilinear interpolationon the colors of those texels. By using the mixed mipmap that includesboth mipmap levels defined using distance fields and mipmap levelsdefined using RGBA, the display engine is able to accommodate differentrendering scales without loss of quality due to the limitations ofdistance fields.

FIG. 14 illustrates an example method 1400 for computing a color valuefor a pixel using a mipmap with mixed mipmap levels. The method maybegin at step 1410, where a computing system may a sampling pixel regionwithin a texture. The texture may be associated with mipmap levelshaving different resolutions of the texture. The mipmap levels may begenerated from the original texture. The mipmap levels may include atleast a first mipmap level defined by color texels and a second mipmaplevel defined by distance-field texels. The first mipmap level definedby color texels may have a lower resolution than the second mipmap leveldefined by distance-field texels. The first mipmap level may have thelowest resolution in the mipmap and the second mipmap level defined bydistance field texels may have the highest resolution in the mipmap.

At step 1420, the system may select one of the mipmap levels based on asize of the sampling pixel region and a size of a texel in the selectedmipmap level. For example, the selected mipmap level may be selectedbased on a ratio between the size of the sampling pixel region and thesize of each texel in the selected mipmap level. For instance, thesystem may identify a mipmap level whose texel sizes are similar to thesize of the sampling pixel region (e.g., the pixel size to texel sizeratio is close to 1-to-1).

At step 1430, the system may determine whether the selected mipmap levelis defined by color texels or distance-field texels. If the systemdetermines that the selected mipmap level is defined by color texels,then at step 1440, the system may select a corresponding rendering logicconfigured to process color texels. Then at step 1445, the selectedrendering logic may process the color texels to compute a color valuefor the sampling pixel region using the selected mipmap level. Forexample, the rendering logic may identify, from the selected mipmaplevel, the four closest color texels relative to the sampling pixelregion and perform bilinear interpolation or bicubic interpolation tocompute the color value for the sampling pixel region.

If, on the other hand, the system determines that the selected mipmaplevel is defined by distance-field texels, then at step 1450 it mayselect a second rendering logic configured to process distance-fieldtexels. Then at step 1455, the system may compute a color value for thesampling pixel region using the selected second rendering logic and themipmap level defined by distance-field texels. The rendering logic maybe the based on the embodiments described above with reference to FIGS.4, 7, 10, or 12.

Eliminating Interpolation Based on Comparison of MSB

In particular embodiments, the process of interpolating the distancefields of the nearest four texels to determine an interpolated distance(or two distances in the case of dual distance field labels) for asample point on a texture map may be optimized in situations where theMSB of the distance fields of the nearest four texels are the same. Asdescribed in further detail above, the main purpose for interpolatingthe distance fields of the nearest for texels is to determine whetherthe sample point is “in” or “out,” which is indicated by the MSB of theinterpolated distance. As such, in situations where the four distancefields of the four nearest texels all have the same MSB (e.g., 0 or 1),the MSB for the sample point can simply be selected to be the same MSBwithout having to calculate the interpolated distance (e.g., using pointsampling rather than bilinear interpolation sampling). Being able todetermine the MSB without having to perform bilinear interpolation helpsto optimize operational efficiency and remove unnecessarycalculation-heavy processing steps. The MSB determined in this mannermay then be used to select the appropriate texel whose color indexspecifies the color for the sample point, as described above.

As an example, in the method 400 for determining the color of a samplepoint using a single distance field texel array with a fine grain colorindex, as shown in FIG. 4, after the four nearest texels to the samplepoint 314 are determined in step 410 and before the distance for samplepoint 314 is computed via bilinear interpolation based on the distancefields of texels 318, 320, 322, and 324, the pixel block may conduct apreliminary analysis to determine whether the MSBs of the distancefields of the four texels 318, 320, 322, and 324 are the same. If, forexample, the MSBs of the distance fields of all four texels 318, 320,322, and 324 are all 0 (i.e., “out”), then the MSB of the interpolateddistance of sample point 314, if it were to be computed, must also be 0.As such, the pixel block can simply bypass the interpolation step 420,which is computationally expensive, and proceed to steps 440 and thesubsequent steps to identify the texel whose color index specifies thecolor for of the sample point 314. If, on the other hand, the MSBs ofthe distance fields of all four texels 318, 320, 322, and 324 are all 1(i.e., “in”), then the MSB of the sample point 314 must also be 1, andthe method 400 can simply bypass the interpolation step 420 and proceedto step 460 and the subsequent steps to determine which texel's colorindex is to be used. This optimization technique may also be used in theembodiment where coarse color indices are defined for single distancefield texels.

A similar optimization technique may be applied in the dual distancefiled embodiments. In both the fine grain index and coarse grain indexembodiments, the sample point's “in” or “out” statuses with respect todistance0 and distance1 are used to select the color index for thesample point. In the embodiments described above, whether the samplepoint is “in” or “out” with respect to the closest type0 edge isdetermined by the MSB of its interpolated distance0, which is computedusing the distance0 values of the four nearest texels. If the MSBs ofthe distance0 values of the four nearest texels are the same (e.g., all1s or all 0s), then the MSB of the sample point's distance0 value may beset to the same MSB (e.g., via point sampling). Similarly, whether thesample point is “in” or “out” with respect to the closest type1 edge isdetermined by the MSB of its interpolated distance1, which is computedusing the distance1 values of the four nearest texels. If the MSBs ofthe distance1 values of the four nearest texels are the same (e.g., all1s or all 0s), then the MSB of the sample point's distance1 value may beset to the same MSB (e.g., via point sampling). The two MSBs of thesample point (i.e., one associated with distance0 and the otherassociated with distance1) may be independently computed, which meansthat one, both, or neither may be computed using the optimizationtechnique. For example, the MSB associated with distance0 may becomputed using the optimization technique while the MSB associated withdistance1 may be computed using bilinear interpolation. Once the twoMSBs have been determined, the pixel block may use them to select theappropriate index for the sample point, as described in more detailelsewhere herein.

FIG. 15 illustrates an example method 1500 for determining the color fora sampling location without interpolation. The method may begin at step1510, where a computing system may determine a sampling location withina texture that comprises a plurality of texels. Each texel may encode adistance field indicating (1) a distance between the texel and an edgedepicted in the texture and (2) an indicator indicating whether thetexel is on a first predetermined side of the edge or a secondpredetermined side of the edge. For instance, the indicator may encodewhether the texel is “in” or “out” relative to the edge. At step 1520,the system may select, based on the sampling location, a set of texelsin the plurality of texels to use to determine a color for the samplinglocation. For example, the system may select the four closest texels tothe sampling location. At step 1530, the system may determine whetherthe set of texels have the same indicators. If the indicators aredifferent (e.g., some texels are “in” and some texels are “out”), theninterpolation may be used to compute the color for the samplinglocation, such as in accordance with the embodiments described abovewith reference to FIGS. 4, 7, 10, or 12. However, if it is determinedthat the set of texels have the same indicators, then at step 1540 thesystem may select, based on the indicator of any texel in the set oftexels, a subset of the set of texels. For example, if the commonindicator between the four texels is “out”, then the two even texels maybe selected. On the other hand, if the four texels are “in,” then thetwo odd texels may be selected. At step 1550, the system may select atexel from the subset of texels based on a distance between the texeland the sampling location. Then at step 1560, the system may determinethe color for the sampling location using the selected texel. Forexample, each of the texels may encode a color index into a color table(e.g., FIG. 3b ) that may be used to determine the color for thesampling location.

Detecting Transparent Result to Allow Discarding of Pixel

In particular embodiments, using the distance fields of the nearest fourtexels to determine an interpolated distance(s) for a sample point on atexture map may be optimized and/or eliminated in situations where thedistance field color indices that apply to the sample point aretransparent. This can occur in two different scenarios. The firstscenario is where the color indices of the distance fields of thenearest four texels to the sample point all correspond to “transparent”in the color table entry. The second scenario is where the sample pointis determined to be outside the texel array (e.g., more than ½ texellength outside the texel array) and thus deemed to be transparent. Inthese scenarios, the sample point can simply be deemed to betransparent, thereby removing unnecessary calculation-heavy processingsteps, such as bilinear interpolation.

As an example of the first scenario, in the method 400 for using thefine grain color index to determine the color of a sample point in asingle distance field texel array, after the four nearest texels tosample point are determined in step 410 and before the distance forsample point 314 is computed via bilinear interpolation, the method canconduct a preliminary analysis to determine whether the color index ofeach of the four texels 318, 320, 322, and 324 corresponds to“transparent.” If this is the case, then the method 400 can skip theremaining steps and simply code the sample point as transparent. Thesame preliminary analysis may be performed in the coarse grain, singledistance field embodiments. For the dual distance field embodiments(i.e., fine grain and coarse grain), a similar preliminary analysis maybe performed to determine whether all the candidate color indices(including those associated with distance0 and distance1) associatedwith the four nearby texels correspond to “transparent.” If so, then thesample point may be directly marked as being “transparent” withoutperforming bilinear interpolation.

Systems and Methods

FIG. 16 illustrates an example computer system 1600. In particularembodiments, one or more computer systems 1600 perform one or more stepsof one or more methods described or illustrated herein. In particularembodiments, one or more computer systems 1600 provide functionalitydescribed or illustrated herein. In particular embodiments, softwarerunning on one or more computer systems 1600 performs one or more stepsof one or more methods described or illustrated herein or providesfunctionality described or illustrated herein. Particular embodimentsinclude one or more portions of one or more computer systems 1600.Herein, reference to a computer system may encompass a computing device,and vice versa, where appropriate. Moreover, reference to a computersystem may encompass one or more computer systems, where appropriate.

This disclosure contemplates any suitable number of computer systems1600. This disclosure contemplates computer system 1600 taking anysuitable physical form. As example and not by way of limitation,computer system 1600 may be an embedded computer system, asystem-on-chip (SOC), a single-board computer system (SBC) (such as, forexample, a computer-on-module (COM) or system-on-module (SOM)), adesktop computer system, a laptop or notebook computer system, aninteractive kiosk, a mainframe, a mesh of computer systems, a mobiletelephone, a personal digital assistant (PDA), a server, a tabletcomputer system, an augmented/virtual reality device, or a combinationof two or more of these. Where appropriate, computer system 1600 mayinclude one or more computer systems 1600; be unitary or distributed;span multiple locations; span multiple machines; span multiple datacenters; or reside in a cloud, which may include one or more cloudcomponents in one or more networks. Where appropriate, one or morecomputer systems 1600 may perform without substantial spatial ortemporal limitation one or more steps of one or more methods describedor illustrated herein. As an example and not by way of limitation, oneor more computer systems 1600 may perform in real time or in batch modeone or more steps of one or more methods described or illustratedherein. One or more computer systems 1600 may perform at different timesor at different locations one or more steps of one or more methodsdescribed or illustrated herein, where appropriate.

In particular embodiments, computer system 1600 includes a processor1602, memory 1604, storage 1606, an input/output (I/O) interface 1608, acommunication interface 1610, and a bus 1612. Although this disclosuredescribes and illustrates a particular computer system having aparticular number of particular components in a particular arrangement,this disclosure contemplates any suitable computer system having anysuitable number of any suitable components in any suitable arrangement.

In particular embodiments, processor 1602 includes hardware forexecuting instructions, such as those making up a computer program. Asan example and not by way of limitation, to execute instructions,processor 1602 may retrieve (or fetch) the instructions from an internalregister, an internal cache, memory 1604, or storage 1606; decode andexecute them; and then write one or more results to an internalregister, an internal cache, memory 1604, or storage 1606. In particularembodiments, processor 1602 may include one or more internal caches fordata, instructions, or addresses. This disclosure contemplates processor1602 including any suitable number of any suitable internal caches,where appropriate. As an example and not by way of limitation, processor1602 may include one or more instruction caches, one or more datacaches, and one or more translation lookaside buffers (TLBs).Instructions in the instruction caches may be copies of instructions inmemory 1604 or storage 1606, and the instruction caches may speed upretrieval of those instructions by processor 1602. Data in the datacaches may be copies of data in memory 1604 or storage 1606 forinstructions executing at processor 1602 to operate on; the results ofprevious instructions executed at processor 1602 for access bysubsequent instructions executing at processor 1602 or for writing tomemory 1604 or storage 1606; or other suitable data. The data caches mayspeed up read or write operations by processor 1602. The TLBs may speedup virtual-address translation for processor 1602. In particularembodiments, processor 1602 may include one or more internal registersfor data, instructions, or addresses. This disclosure contemplatesprocessor 1602 including any suitable number of any suitable internalregisters, where appropriate. Where appropriate, processor 1602 mayinclude one or more arithmetic logic units (ALUs); be a multi-coreprocessor; or include one or more processors 1602. Although thisdisclosure describes and illustrates a particular processor, thisdisclosure contemplates any suitable processor.

In particular embodiments, memory 1604 includes main memory for storinginstructions for processor 1602 to execute or data for processor 1602 tooperate on. As an example and not by way of limitation, computer system1600 may load instructions from storage 1606 or another source (such as,for example, another computer system 1600) to memory 1604. Processor1602 may then load the instructions from memory 1604 to an internalregister or internal cache. To execute the instructions, processor 1602may retrieve the instructions from the internal register or internalcache and decode them. During or after execution of the instructions,processor 1602 may write one or more results (which may be intermediateor final results) to the internal register or internal cache. Processor1602 may then write one or more of those results to memory 1604. Inparticular embodiments, processor 1602 executes only instructions in oneor more internal registers or internal caches or in memory 1604 (asopposed to storage 1606 or elsewhere) and operates only on data in oneor more internal registers or internal caches or in memory 1604 (asopposed to storage 1606 or elsewhere). One or more memory buses (whichmay each include an address bus and a data bus) may couple processor1602 to memory 1604. Bus 1612 may include one or more memory buses, asdescribed below. In particular embodiments, one or more memorymanagement units (MMUs) reside between processor 1602 and memory 1604and facilitate accesses to memory 1604 requested by processor 1602. Inparticular embodiments, memory 1604 includes random access memory (RAM).This RAM may be volatile memory, where appropriate. Where appropriate,this RAM may be dynamic RAM (DRAM) or static RAM (SRAM). Moreover, whereappropriate, this RAM may be single-ported or multi-ported RAM. Thisdisclosure contemplates any suitable RAM. Memory 1604 may include one ormore memories 1604, where appropriate. Although this disclosuredescribes and illustrates particular memory, this disclosurecontemplates any suitable memory.

In particular embodiments, storage 1606 includes mass storage for dataor instructions. As an example and not by way of limitation, storage1606 may include a hard disk drive (HDD), a floppy disk drive, flashmemory, an optical disc, a magneto-optical disc, magnetic tape, or aUniversal Serial Bus (USB) drive or a combination of two or more ofthese. Storage 1606 may include removable or non-removable (or fixed)media, where appropriate. Storage 1606 may be internal or external tocomputer system 1600, where appropriate. In particular embodiments,storage 1606 is non-volatile, solid-state memory. In particularembodiments, storage 1606 includes read-only memory (ROM). Whereappropriate, this ROM may be mask-programmed ROM, programmable ROM(PROM), erasable PROM (EPROM), electrically erasable PROM (EEPROM),electrically alterable ROM (EAROM), or flash memory or a combination oftwo or more of these. This disclosure contemplates mass storage 1606taking any suitable physical form. Storage 1606 may include one or morestorage control units facilitating communication between processor 1602and storage 1606, where appropriate. Where appropriate, storage 1606 mayinclude one or more storages 1606. Although this disclosure describesand illustrates particular storage, this disclosure contemplates anysuitable storage.

In particular embodiments, I/O interface 1608 includes hardware,software, or both, providing one or more interfaces for communicationbetween computer system 1600 and one or more I/O devices. Computersystem 1600 may include one or more of these I/O devices, whereappropriate. One or more of these I/O devices may enable communicationbetween a person and computer system 1600. As an example and not by wayof limitation, an I/O device may include a keyboard, keypad, microphone,monitor, mouse, printer, scanner, speaker, still camera, stylus, tablet,touch screen, trackball, video camera, another suitable I/O device or acombination of two or more of these. An I/O device may include one ormore sensors. This disclosure contemplates any suitable I/O devices andany suitable I/O interfaces 1608 for them. Where appropriate, I/Ointerface 1608 may include one or more device or software driversenabling processor 1602 to drive one or more of these I/O devices. I/Ointerface 1608 may include one or more I/O interfaces 1608, whereappropriate. Although this disclosure describes and illustrates aparticular I/O interface, this disclosure contemplates any suitable I/Ointerface.

In particular embodiments, communication interface 1610 includeshardware, software, or both providing one or more interfaces forcommunication (such as, for example, packet-based communication) betweencomputer system 1600 and one or more other computer systems 1600 or oneor more networks. As an example and not by way of limitation,communication interface 1610 may include a network interface controller(NIC) or network adapter for communicating with an Ethernet or otherwire-based network or a wireless NIC (WNIC) or wireless adapter forcommunicating with a wireless network, such as a WI-FI network. Thisdisclosure contemplates any suitable network and any suitablecommunication interface 1610 for it. As an example and not by way oflimitation, computer system 1600 may communicate with an ad hoc network,a personal area network (PAN), a local area network (LAN), a wide areanetwork (WAN), a metropolitan area network (MAN), or one or moreportions of the Internet or a combination of two or more of these. Oneor more portions of one or more of these networks may be wired orwireless. As an example, computer system 1600 may communicate with awireless PAN (WPAN) (such as, for example, a BLUETOOTH WPAN), a WI-FInetwork, a WI-MAX network, a cellular telephone network (such as, forexample, a Global System for Mobile Communications (GSM) network), orother suitable wireless network or a combination of two or more ofthese. Computer system 1600 may include any suitable communicationinterface 1610 for any of these networks, where appropriate.Communication interface 1610 may include one or more communicationinterfaces 1610, where appropriate. Although this disclosure describesand illustrates a particular communication interface, this disclosurecontemplates any suitable communication interface.

In particular embodiments, bus 1612 includes hardware, software, or bothcoupling components of computer system 1600 to each other. As an exampleand not by way of limitation, bus 1612 may include an AcceleratedGraphics Port (AGP) or other graphics bus, an Enhanced Industry StandardArchitecture (EISA) bus, a front-side bus (FSB), a HYPERTRANSPORT (HT)interconnect, an Industry Standard Architecture (ISA) bus, an INFINIBANDinterconnect, a low-pin-count (LPC) bus, a memory bus, a Micro ChannelArchitecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, aPCI-Express (PCIe) bus, a serial advanced technology attachment (SATA)bus, a Video Electronics Standards Association local (VLB) bus, oranother suitable bus or a combination of two or more of these. Bus 1612may include one or more buses 1612, where appropriate. Although thisdisclosure describes and illustrates a particular bus, this disclosurecontemplates any suitable bus or interconnect.

Herein, a computer-readable non-transitory storage medium or media mayinclude one or more semiconductor-based or other integrated circuits(ICs) (such, as for example, field-programmable gate arrays (FPGAs) orapplication-specific ICs (ASICs)), hard disk drives (HDDs), hybrid harddrives (HHDs), optical discs, optical disc drives (ODDs),magneto-optical discs, magneto-optical drives, floppy diskettes, floppydisk drives (FDDs), magnetic tapes, solid-state drives (SSDs),RAM-drives, SECURE DIGITAL cards or drives, any other suitablecomputer-readable non-transitory storage media, or any suitablecombination of two or more of these, where appropriate. Acomputer-readable non-transitory storage medium may be volatile,non-volatile, or a combination of volatile and non-volatile, whereappropriate.

Herein, “or” is inclusive and not exclusive, unless expressly indicatedotherwise or indicated otherwise by context. Therefore, herein, “A or B”means “A, B, or both,” unless expressly indicated otherwise or indicatedotherwise by context. Moreover, “and” is both joint and several, unlessexpressly indicated otherwise or indicated otherwise by context.Therefore, herein, “A and B” means “A and B, jointly or severally,”unless expressly indicated otherwise or indicated otherwise by context.

The scope of this disclosure encompasses all changes, substitutions,variations, alterations, and modifications to the example embodimentsdescribed or illustrated herein that a person having ordinary skill inthe art would comprehend. The scope of this disclosure is not limited tothe example embodiments described or illustrated herein. Moreover,although this disclosure describes and illustrates respectiveembodiments herein as including particular components, elements,feature, functions, operations, or steps, any of these embodiments mayinclude any combination or permutation of any of the components,elements, features, functions, operations, or steps described orillustrated anywhere herein that a person having ordinary skill in theart would comprehend. Furthermore, reference in the appended claims toan apparatus or system or a component of an apparatus or system beingadapted to, arranged to, capable of, configured to, enabled to, operableto, or operative to perform a particular function encompasses thatapparatus, system, component, whether or not it or that particularfunction is activated, turned on, or unlocked, as long as thatapparatus, system, or component is so adapted, arranged, capable,configured, enabled, operable, or operative. Additionally, although thisdisclosure describes or illustrates particular embodiments as providingparticular advantages, particular embodiments may provide none, some, orall of these advantages.

What is claimed is:
 1. A method comprising: determining, by a computingsystem, a sampling pixel region within a texture, wherein the texture isassociated with mipmap levels having different resolutions of thetexture, wherein the mipmap levels include at least a first mipmap leveldefined by color texels and a second mipmap level defined bydistance-field texels; selecting, by the computing system, one of themipmap levels based on a size of the sampling pixel region and a size ofa texel in the selected mipmap level; and computing, by the computingsystem, a color value for the sampling pixel region using the selectedmipmap level.
 2. The method of claim 1, further comprising: determiningthat the selected mipmap level is defined by color texels; and selectinga first rendering logic configured to process color texels; wherein thecolor value is computed using the selected first rendering logic.
 3. Themethod of claim 2, further comprising: determining a second samplingpixel region within the texture; selecting, from the mipmap levels, thesecond mipmap level defined by distance-field texels based on a size ofthe second sampling pixel region and a size of each of thedistance-field texels in the second mipmap level; selecting a secondrendering logic configured to process distance-field texels; andcomputing a second color value for the second sampling pixel regionusing the selected second rendering logic and the second mipmap level.4. The method of claim 1, wherein the selected mipmap level is selectedbased on a ratio between the size of the sampling pixel region and thesize of each texel in the selected mipmap level.
 5. The method of claim1, wherein the first mipmap level defined by color texels has a lowerresolution than the second mipmap level defined by distance-fieldtexels.
 6. The method of claim 1, wherein the first mipmap level definedby color texels has a lowest resolution in the mipmap levels and thesecond mipmap level defined by distance-field texels has a highestresolution in the mipmap levels.
 7. The method of claim 1, whereinsegments of two edges appearing in the first mipmap level are separatedby less than two of the color texels.
 8. The method of claim 1, furthercomprising: generating the mipmap levels using the texture.
 9. A systemcomprising: one or more processors; and one or more computer-readablenon-transitory storage media coupled to one or more of the processorsand comprising instructions operable when executed by one or more of theprocessors to cause the system to: determine a sampling pixel regionwithin a texture, wherein the texture is associated with mipmap levelshaving different resolutions of the texture, wherein the mipmap levelsinclude at least a first mipmap level defined by color texels and asecond mipmap level defined by distance-field texels; select one of themipmap levels based on a size of the sampling pixel region and a size ofa texel in the selected mipmap level; and compute a color value for thesampling pixel region using the selected mipmap level.
 10. The system ofclaim 9, wherein the processors are further operable when executing theinstructions to: determine that the selected mipmap level is defined bycolor texels; and select a first rendering logic configured to processcolor texels; wherein the color value is computed using the selectedfirst rendering logic.
 11. The system of claim 10, wherein theprocessors are further operable when executing the instructions to:determine a second sampling pixel region within the texture; select,from the mipmap levels, the second mipmap level defined bydistance-field texels based on a size of the second sampling pixelregion and a size of each of the distance-field texels in the secondmipmap level; select a second rendering logic configured to processdistance-field texels; and compute a second color value for the secondsampling pixel region using the selected second rendering logic and thesecond mipmap level.
 12. The system of claim 9, wherein the selectedmipmap level is selected based on a ratio between the size of thesampling pixel region and the size of each texel in the selected mipmaplevel.
 13. The system of claim 9, wherein the first mipmap level definedby color texels has a lower resolution than the second mipmap leveldefined by distance-field texels.
 14. The system of claim 9, wherein thefirst mipmap level defined by color texels has a lowest resolution inthe mipmap levels and the second mipmap level defined by distance-fieldtexels has a highest resolution in the mipmap levels.
 15. One or morecomputer-readable non-transitory storage media embodying software thatis operable when executed by one or more processors to: determine asampling pixel region within a texture, wherein the texture isassociated with mipmap levels having different resolutions of thetexture, wherein the mipmap levels include at least a first mipmap leveldefined by color texels and a second mipmap level defined bydistance-field texels; select one of the mipmap levels based on a sizeof the sampling pixel region and a size of a texel in the selectedmipmap level; and compute a color value for the sampling pixel regionusing the selected mipmap level.
 16. The media of claim 15, wherein theone or more processors are further operable when executing theinstructions to: determine that the selected mipmap level is defined bycolor texels; and select a first rendering logic configured to processcolor texels; wherein the color value is computed using the selectedfirst rendering logic.
 17. The media of claim 16, wherein the one ormore processors are further operable when executing the instructions to:determine a second sampling pixel region within the texture; select,from the mipmap levels, the second mipmap level defined bydistance-field texels based on a size of the second sampling pixelregion and a size of each of the distance-field texels in the secondmipmap level; select a second rendering logic configured to processdistance-field texels; and compute a second color value for the secondsampling pixel region using the selected second rendering logic and thesecond mipmap level.
 18. The media of claim 15, wherein the selectedmipmap level is selected based on a ratio between the size of thesampling pixel region and the size of each texel in the selected mipmaplevel.
 19. The media of claim 15, wherein the first mipmap level definedby color texels has a lower resolution than the second mipmap leveldefined by distance-field texels.
 20. The media of claim 15, wherein thefirst mipmap level defined by color texels has a lowest resolution inthe mipmap levels and the second mipmap level defined by distance-fieldtexels has a highest resolution in the mipmap levels.